/* Gaijin Trader — hand-tuned, no frameworks */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --r: 8px;
  --r-lg: 12px;
  --side: 232px;
}

[data-theme="dark"] {
  --bg: #161513;
  --surface: #1e1d1a;
  --raise: #272522;
  --line: rgba(255, 246, 230, .09);
  --line-2: rgba(255, 246, 230, .16);
  --text: #eeeae3;
  --muted: #a29d93;
  --faint: #6f6b64;
  --accent: #e8a33d;
  --accent-ink: #1b1305;
  --accent-soft: rgba(232, 163, 61, .12);
  --green: #7cc196;
  --green-soft: rgba(124, 193, 150, .12);
  --red: #ec7b66;
  --red-soft: rgba(236, 123, 102, .12);
  --blue: #86afe0;
  --c1: #e8a33d; --c2: #86afe0; --c3: #7cc196; --c4: #c79ad9;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --raise: #f0ede8;
  --line: #e7e3dc;
  --line-2: #d6d1c8;
  --text: #24221f;
  --muted: #6b665e;
  --faint: #9c968c;
  --accent: #b86e12;
  --accent-ink: #ffffff;
  --accent-soft: #fbefdd;
  --green: #2d8653;
  --green-soft: #e6f2ea;
  --red: #c2463a;
  --red-soft: #fbe9e6;
  --blue: #2f6db3;
  --c1: #d08a2a; --c2: #4f86c6; --c3: #46a171; --c4: #9b6bbd;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
svg { width: 18px; height: 18px; flex: none; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
code { font-family: var(--mono); font-size: .9em; background: var(--raise); padding: 1px 5px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.pos { color: var(--green); }
.neg { color: var(--red); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */

.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); }
.brand-name { font-weight: 650; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px;
  border-radius: var(--r);
  color: var(--muted); text-decoration: none;
  transition: background .12s, color .12s;
}
.nav a:hover { background: var(--raise); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); }
.nav a.on svg { color: var(--accent); }

.side-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.token-chip {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted);
  padding: 6px 8px;
}
.token-chip span { overflow: hidden; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.token-chip svg { flex: none; }
.token-chip.ok svg { color: var(--green); }
.token-chip.bad svg { color: var(--red); }

.main { min-width: 0; padding: 0 40px 64px; }

/* -------------------------------------------------------------- top bar */

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  margin: 0 -40px 8px; padding: 14px 40px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.status { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.status.run .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); animation: pulse 2.4s ease-in-out infinite; }
.status.stopping .dot { background: var(--accent); }
.status.err .dot { background: var(--red); }
.status > div { min-width: 0; }
.status-title { font-weight: 600; }
.status-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

.controls { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); cursor: pointer;
  font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--raise); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn.ghost { background: transparent; }
.btn.busy svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--raise); color: var(--text); }

select, input:not([type="checkbox"]) {
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface);
  outline: none;
}
select { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--faint); }

.banner {
  display: flex; align-items: center; gap: 10px;
  max-width: 1120px; margin: 16px 0 0; padding: 10px 14px;
  background: var(--accent-soft); border-radius: var(--r);
  font-size: 14px;
}
.banner svg { color: var(--accent); }

/* ---------------------------------------------------------------- pages */

.page { max-width: 1120px; padding-top: 24px; animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 650; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
.lead { color: var(--muted); max-width: 680px; margin: -12px 0 24px; }
.label { font-size: 12.5px; color: var(--muted); }
.link { font-size: 13px; color: var(--muted); text-decoration: none; }
.link:hover { color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* overview */
.worth { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 32px; align-items: end; margin-bottom: 28px; }
.big { font-size: 44px; line-height: 1.05; font-weight: 650; margin: 6px 0 6px; letter-spacing: -.03em; }
.big small { font-size: 18px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.worth-chart { height: 110px; position: relative; }
.worth-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.worth-chart .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; border: 1px dashed var(--line-2); border-radius: var(--r); }

.split { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--line); }
.split > div { position: relative; padding: 14px 16px 12px 18px; border-right: 1px solid var(--line); }
.split > div:last-child { border-right: 0; }
.split > div:first-child { padding-left: 18px; }
.split .sw { position: absolute; left: 0; top: 19px; width: 8px; height: 8px; border-radius: 2px; }
.split > div:not(:first-child) .sw { left: 0; margin-left: 0; }
.split > div:not(:first-child) { padding-left: 34px; }
.split > div:not(:first-child) .sw { left: 18px; }
.mid { font-size: 19px; font-weight: 600; margin-top: 2px; }
.sw-1 { background: var(--c1); } .sw-2 { background: var(--c2); } .sw-3 { background: var(--c3); } .sw-4 { background: var(--c4); }
.meter { display: flex; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; margin: 4px 0 32px; background: var(--raise); }
.meter i { display: block; height: 100%; width: 0; transition: width .4s ease; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.kv { margin: 0; display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 7px 0; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--faint); font-variant-numeric: tabular-nums; }
.feed .empty, .empty-row { color: var(--faint); }
.feed li.empty { display: block; }
.banner a { color: var(--accent); font-weight: 600; margin-left: auto; text-decoration: none; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--raise); }
.table .r { text-align: right; }
.table .item { font-weight: 500; }
.table .hash { display: block; font: 12px var(--mono); color: var(--faint); margin-top: 1px; }
.table .empty-row td { text-align: center; padding: 40px 16px; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 600; }
.tag.buy { background: var(--accent-soft); color: var(--accent); }
.tag.sell { background: var(--green-soft); color: var(--green); }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs button { height: 34px; padding: 0 12px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); cursor: pointer; }
.tabs button b { font-weight: 500; color: var(--faint); margin-left: 4px; }
.tabs button.on { background: var(--raise); color: var(--text); }

/* sales */
.grid-sales { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li { font-size: 13.5px; }
.bars .row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.bars .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .track { height: 5px; background: var(--raise); border-radius: 3px; }
.bars .fill { height: 100%; background: var(--green); border-radius: 3px; }

/* items */
.adder { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.combo { position: relative; flex: 1; min-width: 260px; }
.combo > svg { position: absolute; left: 12px; top: 11px; color: var(--faint); }
.combo input { width: 100%; padding-left: 38px; }
.suggest {
  position: absolute; z-index: 10; left: 0; right: 0; top: 44px;
  list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.suggest li:hover, .suggest li.on { background: var(--raise); }
.suggest small { display: block; font: 11.5px var(--mono); color: var(--faint); }

.lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.count { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chips { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 440px; overflow: auto; }
.chips li { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 8px; border-radius: 6px; font-size: 14px; }
.chips li:hover { background: var(--raise); }
.chips li div { flex: 1; min-width: 0; }
.chips { overflow-x: hidden; }
.chips li.guess span, .item.guess { color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.names-state { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.names-state.err { color: var(--neg, #e5484d); }
.chips li span, .chips li small { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips li small { font: 11.5px var(--mono); color: var(--faint); }
.chips .icon-btn { width: 30px; height: 30px; opacity: 0; }
.chips li:hover .icon-btn, .chips .icon-btn:focus-visible { opacity: 1; }
.chips .empty { color: var(--faint); font-size: 13.5px; padding: 8px; }

.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 11px; color: var(--faint); }
.search input { padding-left: 36px; width: 240px; }

/* log */
.log {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  font: 13px/1.6 var(--mono); padding: 10px 0; max-height: calc(100vh - 220px); overflow: auto;
}
.log .ln { display: grid; grid-template-columns: 74px 64px 1fr; gap: 8px; padding: 2px 18px; }
.log .ln:hover { background: var(--raise); }
.log time { color: var(--faint); }
.log .lv { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding-top: 1px; color: var(--faint); }
.log .lv-buy { color: var(--accent); } .log .lv-sell { color: var(--green); }
.log .lv-warn { color: var(--accent); } .log .lv-error { color: var(--red); }
.log .ln-error .msg { color: var(--red); }
.log .empty { padding: 40px; text-align: center; color: var(--faint); font-family: var(--font); }

/* settings */
.settings { max-width: 760px; }
fieldset { border: 0; margin: 0 0 32px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
legend { font-weight: 600; margin-bottom: 14px; padding: 0; }
legend small { color: var(--faint); font-weight: 400; margin-left: 6px; }
.field { display: grid; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 13.5px; color: var(--muted); }
.field small { font-size: 13px; color: var(--faint); line-height: 1.45; }
.field.bad input { border-color: var(--red); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; align-self: end; height: 40px; }
.toggle input { position: absolute; opacity: 0; }
.toggle.wide { grid-column: 1 / -1; height: auto; }
.toggle i { flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(16px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-foot { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; max-width: 380px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--text); color: var(--bg); font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: rise .18s ease-out;
}
.toast.err svg { color: var(--red); }
.toast.ok svg { color: var(--green); }
.toast.warn svg { color: var(--accent); }

.only-mobile { display: none; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  .grid-2, .grid-sales, .lists { grid-template-columns: 1fr; }
  .worth { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .only-mobile { display: grid; }
  .main { padding: 0 16px 48px; }
  .bar { margin: 0 -16px 8px; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .controls { width: 100%; }
  .controls .select { flex: 1; }
  .controls select { width: 100%; }
  .controls .btn span { display: none; }
  .controls .btn { width: 44px; padding: 0; }
  .split { grid-template-columns: 1fr 1fr; }
  .split > div:nth-child(2) { border-right: 0; }
  .split > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .split > div:nth-child(3) { padding-left: 18px; }
  .split > div:nth-child(3) .sw { left: 0; }
  .big { font-size: 36px; }
  fieldset { grid-template-columns: 1fr; }
  .page-head .btn span { display: none; }
  .page-head .btn { width: 44px; padding: 0; }
  .search input { width: 160px; }
  .log .ln { grid-template-columns: 60px 1fr; }
  .log .lv { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* settings: token help + connection check */
.wide { grid-column: 1 / -1; }
.opt { color: var(--faint); font-weight: 400; margin-left: 6px; font-size: 12.5px; }
.howto { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; }
.howto summary { cursor: pointer; padding: 11px 0; color: var(--muted); font-size: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.howto[open] summary::before { transform: rotate(45deg); }
.howto ol { margin: 0 0 8px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.howto p { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.howto a { color: var(--accent); }
kbd { font: 12px var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }
.check { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.check-list li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 14px; }
.check-list li svg { width: 18px; height: 18px; margin-top: 1px; }
.check-list .ok svg { color: var(--green); }
.check-list .bad svg { color: var(--red); }
.check-list b { font-weight: 600; }
.check-list span { color: var(--muted); }

/* item thumbnails: real picture from the market if available, SVG by category otherwise */
.it { display: flex; align-items: center; gap: 12px; min-width: 0; }
.it-text { min-width: 0; }
.thumb {
  position: relative; flex: none;
  width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--raise); color: var(--muted);
  border: 1px solid var(--line);
}
.thumb svg { width: 22px; height: 22px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--raise); }
.thumb.sm { width: 28px; height: 28px; border-radius: 6px; }
.thumb.sm svg { width: 16px; height: 16px; }
.c-vehicle { color: var(--c2); background: color-mix(in srgb, var(--c2) 12%, var(--surface)); }
.c-key     { color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, var(--surface)); }
.c-trophy  { color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, var(--surface)); }
.c-decal   { color: var(--c4); background: color-mix(in srgb, var(--c4) 12%, var(--surface)); }
.c-camo    { color: var(--c3); background: color-mix(in srgb, var(--c3) 12%, var(--surface)); }
.c-avatar  { color: var(--c4); background: color-mix(in srgb, var(--c4) 12%, var(--surface)); }
.bars .row { align-items: center; }
.bars .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li { display: flex; align-items: center; gap: 10px; }
.table td .it .item { display: block; }

.chips .thumb, .bars .thumb, .suggest .thumb { display: grid; overflow: hidden; }
.howto h4 { margin: 6px 0 8px; font-size: 14px; font-weight: 600; }
.howto ol { margin-bottom: 14px; }
.snippet { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }

/* ---------------------------------------------------------- multi-account */

.hero {
  display: grid; grid-template-columns: minmax(280px, 1fr) minmax(240px, 1.1fr); gap: 32px; align-items: end;
  padding: 22px 24px; margin-bottom: 20px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--accent-soft), transparent 60%), var(--surface);
}
.hero .label { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 600; color: var(--muted); }
.hero-big { font-size: 44px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 6px 0 4px; }
.hero-big small { font-size: .55em; margin-left: 8px; color: var(--muted); font-weight: 600; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 16px; }
.hero-stats div { display: grid; }
.hero-stats b { font-size: 19px; font-weight: 700; }
.hero-stats span { font-size: 12.5px; color: var(--muted); }

.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 24px; }
.acc-card {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); text-align: left; color: inherit; font: inherit;
}
.acc-card.s-run { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.acc-card.s-err, .acc-card.s-bad { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.acc-card.s-off { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.acc-card h3 { margin: 2px 0 4px; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-state { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.s-run .dot, .dot.s-run { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.s-paused .dot, .dot.s-paused, .s-stopping .dot, .dot.s-stopping { background: var(--accent); }
.s-err .dot, .dot.s-err, .s-bad .dot, .dot.s-bad { background: var(--red); }
.acc-meta { margin: 0; font-size: 13px; color: var(--muted); }
.acc-meta b { color: var(--text); font-weight: 600; }
.acc-phase { margin: 2px 0 0; font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; }
.s-err .acc-phase, .s-bad .acc-phase { color: var(--red); }
.acc-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.acc-btns .icon-btn { margin-left: auto; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; gap: 6px; }
.btn.sm svg { width: 13px; height: 13px; }
.acc-card.add {
  align-items: stretch; justify-content: center; gap: 6px; min-height: 150px; padding: 10px;
  border-style: dashed; border-color: var(--line-2); background: transparent; color: var(--muted);
  transition: border-color .15s, color .15s;
}
.acc-card.add:hover { border-color: var(--accent); }
.acc-card.add button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: var(--r); }
.add-main { flex: 1; display: grid; place-items: center; align-content: center; gap: 6px; padding: 12px; text-align: center; }
.add-main svg { width: 22px; height: 22px; padding: 9px; box-sizing: content-box; border-radius: 50%; background: var(--accent-soft); color: var(--accent); transition: transform .2s; }
.add-main b { color: var(--text); font-weight: 600; }
.add-main small { font-size: 12.5px; color: var(--faint); max-width: 260px; line-height: 1.4; }
.add-main:hover b { color: var(--accent); }
.add-main:hover svg { transform: rotate(90deg) scale(1.06); }
.add-paper { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; font-size: 12.5px; }
.add-paper:hover { color: var(--accent); background: var(--accent-soft); }
.add-paper svg { width: 13px; height: 13px; }
.acc-card.add button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.acc-tag { font-weight: 600; color: var(--accent); }
.one-acc .acc-col { display: none; }
.acc-name { display: flex; align-items: center; gap: 10px; }
.acc-name small { display: block; color: var(--muted); font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.small { font-size: 12.5px; }

.dlg {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .4);
}
.dlg::backdrop { background: rgba(10, 9, 8, .6); }
.dlg form, .dlg > div.settings { padding: 20px 22px; margin: 0; max-width: none; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dlg-head h2 { margin: 0; font-size: 19px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-big { font-size: 34px; }
}
#accTable .icon-btn { display: inline-grid; vertical-align: middle; }

/* ---------------------------------------------------------------- login */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(900px 500px at 20% 0%, var(--accent-soft), transparent 70%), var(--bg); }
.login { width: min(400px, 100%); display: grid; gap: 22px; }
.login-brand { justify-content: center; }
.login-card { display: grid; gap: 14px; padding: 26px 26px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .btn { width: 100%; height: 44px; }
.login-card p { margin: 0; }
.login-card code { font-size: 12px; }
.login-err { color: var(--red); font-size: 14px; background: var(--red-soft); padding: 8px 12px; border-radius: var(--r); }

.user-box { margin-top: auto; display: flex; align-items: center; gap: 2px; padding: 10px 0 10px 8px; border-top: 1px solid var(--line); }
.user-box .user-name { flex: 1; min-width: 0; }
.user-box .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.user-box .icon-btn:hover { color: var(--text); }
.user-box .icon-btn svg { width: 17px; height: 17px; }
.user-box + .side-foot { margin-top: 0; }
.user-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.user-name svg { width: 16px; height: 16px; color: var(--accent); }
.dlg-sm { width: min(440px, calc(100vw - 24px)); }

/* daily profit */
.daily-card { margin-bottom: 16px; }
.daily { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; height: 150px; }
.day { display: grid; grid-template-rows: 1fr auto auto; text-align: center; min-width: 0; }
.day .col { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line-2); }
.day .col i { display: block; width: min(28px, 70%); background: var(--green); border-radius: 4px 4px 0 0; opacity: .85; transition: opacity .12s; }
.day .col i.neg { background: var(--red); }
.day:hover .col i { opacity: 1; }
.day span { font-size: 12px; margin-top: 4px; }
.day small { font-size: 10.5px; color: var(--faint); }
.day.we small { color: var(--accent); }

/* inventory */
.inv-sum { display: flex; gap: 40px; margin-bottom: 18px; }
.inv-sum div { display: grid; }
.inv-sum b { font-size: 24px; font-weight: 700; }
.inv-sum small { font-size: 14px; color: var(--muted); }

.acc-warn { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 12.5px; color: var(--accent); }
.acc-warn svg { width: 14px; height: 14px; flex: none; }
.acc-warn a { color: inherit; margin-left: auto; white-space: nowrap; }
#notifyBtn.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--line-2)); }
a.btn { text-decoration: none; color: inherit; }

/* ------------------------------------------------------ animated background */
#bg { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.shell, .login { position: relative; z-index: 1; }
.side { background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(10px); }
.card, .acc-card:not(.add), .table-wrap, .hero, .log, .worth-chart .empty { backdrop-filter: blur(6px); }
.card, .acc-card:not(.add), .table-wrap { background: color-mix(in srgb, var(--surface) 88%, transparent); }
.acc-card.add { background: color-mix(in srgb, var(--surface) 35%, transparent); }
.login-page { background: var(--bg); }
#bgBtn.on { color: var(--accent); }

/* ---------------------------------------------------------- item window */
[data-item] { cursor: pointer; }
.table tr:has([data-item]):hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
[data-item]:hover .item, .chips li[data-item]:hover span, .bars [data-item]:hover .grow { color: var(--accent); }
.dlg-item { width: min(980px, calc(100vw - 24px)); }
.item-dlg { padding: 20px 22px 22px; display: grid; gap: 16px; }
.it-head { display: flex; gap: 18px; align-items: flex-start; }
.thumb.xl { width: 112px; height: 112px; border-radius: 12px; }
.thumb.xl svg { width: 48px; height: 48px; }
.it-title { flex: 1; min-width: 0; display: grid; gap: 6px; }
.it-title h2 { margin: 0; font-size: 22px; line-height: 1.25; }
.it-hash { display: flex; align-items: center; gap: 6px; font: 12.5px var(--mono); color: var(--faint); word-break: break-all; }
.it-hash .icon-btn { width: 26px; height: 26px; }
.it-hash .icon-btn svg { width: 14px; height: 14px; }
.it-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.it-tags .tag { background: var(--raise); color: var(--muted); font-weight: 500; }
.it-tags .tag b { color: var(--text); font-weight: 600; }
.it-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.it-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.it-stat { background: var(--raise); border-radius: var(--r); padding: 10px 14px; }
.it-stat span { display: block; font-size: 12.5px; color: var(--muted); }
.it-stat b { font-size: 19px; font-variant-numeric: tabular-nums; }
.it-stat small { display: block; font-size: 12px; color: var(--faint); }
.it-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.it-sec { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; min-width: 0; }
.it-sec h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.it-desc { white-space: pre-line; color: var(--muted); font-size: 14px; margin: 0; max-height: 180px; overflow: auto; }
.seg { display: inline-flex; background: var(--raise); border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; padding: 3px 10px; border-radius: 5px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pchart { position: relative; height: 220px; }
.pchart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pchart .empty { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 14px; text-align: center; }
.pchart .tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 5px 9px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.pchart text { fill: var(--faint); font-size: 11px; }
.book { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.book th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12px; padding: 0 8px 6px; }
.book tr { position: relative; }
.book td { padding: 4px 8px; }
.book th:last-child, .book td:last-child { text-align: right; }
.book td .depth { position: absolute; top: 1px; bottom: 1px; left: 0; border-radius: 3px; z-index: -1; }
.book tbody { position: relative; z-index: 0; }
.book.sell .depth { background: var(--red-soft); } .book.sell td:first-child { color: var(--red); }
.book.buy .depth { background: var(--green-soft); } .book.buy td:first-child { color: var(--green); }
.book-empty { color: var(--faint); font-size: 13.5px; padding: 4px 8px; }
.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.mini td, .mini th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.mini th { color: var(--faint); font-weight: 500; font-size: 12px; }
.mini td:first-child, .mini th:first-child { text-align: left; }
.mini tr:last-child td { border-bottom: 0; }
.rules { display: flex; flex-wrap: wrap; gap: 8px; }
.rules .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.it-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--faint); font-size: 12.5px; }
.it-warn { background: var(--red-soft); color: var(--red); border-radius: var(--r); padding: 8px 12px; font-size: 13.5px; }
.it-loading { display: grid; place-items: center; min-height: 300px; color: var(--muted); }
@media (max-width: 760px) { .it-grid { grid-template-columns: 1fr; } .thumb.xl { width: 72px; height: 72px; } }

/* ---------------------------------------------------------- scanner */
.scan-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 14px; margin-bottom: 16px; }
.scan-filters .search input { width: 220px; }
.mini-field { display: grid; gap: 4px; }
.mini-field span { font-size: 12px; color: var(--muted); }
.mini-field input, .mini-field select { width: 130px; }
.scan-filters .toggle { height: 40px; }
.scan-progress { display: flex; align-items: center; gap: 14px; margin: -8px 0 18px; font-size: 13.5px; color: var(--muted); }
.scan-progress .bar { flex: 0 1 360px; height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; }
.scan-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
#scanTable td .btn { white-space: nowrap; }
#scanMeta { margin-top: 12px; }

/* ---------------------------------------------------- telegram / backups */
.tg-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .tg-grid { grid-template-columns: 1fr; } }
.tg-grid .card h2 { margin: 0; font-size: 17px; }
.tg-grid .settings { max-width: none; }
.tg-grid fieldset { margin-bottom: 20px; }
.steps { margin: 0 0 18px; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; font-size: 14px; }
.steps b { color: var(--text); }
.tg-pair { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); margin-bottom: 20px; line-height: 1.7; }
.tg-pair > svg { width: 20px; height: 20px; flex: none; margin-top: 4px; color: var(--accent); }
.tg-pair code.big { font-size: 18px; letter-spacing: 2px; padding: 2px 10px; font-weight: 700; }
.tg-pair .btn { margin-top: 6px; }
.checks { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
@media (max-width: 640px) { .checks { grid-template-columns: 1fr; } }
#tgCard .form-foot { flex-wrap: wrap; }
#tgMsg { margin-right: auto; }
.bk-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; max-height: 420px; overflow: auto; }
.bk-list li { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 6px; }
.bk-list li:hover { background: var(--raise); }
.bk-list li > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.bk-list li div { flex: 1; display: grid; }
.bk-list .icon-btn { width: 32px; height: 32px; }
.bk-list .empty { color: var(--faint); font-size: 14px; }
#bkCard .head-actions { gap: 8px; }
#bkCard label.btn { cursor: pointer; }
.checks .check { display: flex; flex-direction: row; justify-content: flex-start; align-items: center; text-align: left; height: auto; }
.checks .check input { flex: none; width: 16px; height: 16px; padding: 0; }
.checks .check span { flex: 1; }
#bkCard .card-head { flex-wrap: wrap; gap: 10px; }
#bkCard .card-head h2 { white-space: nowrap; }
#tgCard .form-foot .btn { height: 36px; padding: 0 12px; font-size: 13.5px; }

/* notification toggles */
#tgNotify { gap: 8px; }
.ntf { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--raise); cursor: pointer; transition: border-color .15s, background .15s, opacity .15s; min-height: 52px; }
.ntf:hover { border-color: var(--line-2); }
.ntf:has(input:not(:checked)) { background: transparent; }
.ntf:has(input:not(:checked)) .ntf-ico { filter: grayscale(1); opacity: .55; }
.ntf:has(input:not(:checked)) .ntf-name { color: var(--muted); }
.ntf-ico { --c: var(--muted); width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); transition: filter .15s, opacity .15s; }
.ntf-ico svg { width: 19px; height: 19px; }
.ntf-name { flex: 1; font-size: 14px; line-height: 1.3; }
.t-green .ntf-ico { --c: var(--green); } .t-blue .ntf-ico { --c: var(--blue); } .t-red .ntf-ico { --c: var(--red); }
.t-accent .ntf-ico { --c: var(--accent); } .t-violet .ntf-ico { --c: var(--c4); } .t-muted .ntf-ico { --c: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .18s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { min-width: 0; } .field input, .field select { min-width: 0; width: 100%; box-sizing: border-box; }

/* ---------------------------------------------------------- 14th iteration */
.h-ico { width: 17px; height: 17px; vertical-align: -3px; margin-right: 7px; color: var(--accent); }
legend .h-ico { width: 16px; height: 16px; }
.ver-line { display: block; padding: 8px 8px 0; font-size: 11.5px; color: var(--faint); text-decoration: none; }
.ver-line.upd { color: var(--accent); }
.ver-line b { font-weight: 600; }

/* comparison */
.cmp-card { margin-top: 20px; }
.cmp-card .card-head { flex-wrap: wrap; gap: 6px 16px; }
.cmp-card h2 { display: flex; align-items: center; }
.table.cmp th:first-child { color: var(--muted); font-weight: 500; text-align: left; white-space: nowrap; width: 1%; }
.table.cmp thead th { vertical-align: bottom; }
.table.cmp thead th small { display: block; font-weight: 400; color: var(--faint); font-size: 11.5px; }
.table.cmp tbody th { font-size: 13px; padding-right: 20px; }
.table.cmp td.best { background: color-mix(in srgb, var(--green) 9%, transparent); }
.table.cmp td small { font-size: 11.5px; }
.cmp-sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 1px; }
.cmp-best { cursor: pointer; border-bottom: 1px dashed var(--line-2); max-width: 180px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cmp-sub { font-size: 14px; margin: 22px 0 8px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.cmp-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.cmp-legend b { color: var(--text); font-weight: 600; }
.cmp-chart { height: 200px; }
.cmp-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.cmp-chart text { fill: var(--faint); font-size: 11px; }
.cmp-chart .empty { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 14px; }

.acc-warn.guard { color: var(--red); }
.tag.manual { background: color-mix(in srgb, var(--blue) 15%, transparent); color: var(--blue); }
.tag.on-tag { background: var(--accent-soft); color: var(--accent); margin-right: auto; margin-left: 8px; }

/* star */
.icon-btn.star { color: var(--faint); }
.icon-btn.star:hover { color: var(--accent); }
.icon-btn.star.on { color: var(--accent); }

/* item card: manual trading + per-item settings */
.it-sec h3 > svg { width: 16px; height: 16px; color: var(--accent); margin-right: -2px; flex: none; }
#it-trade h3, #it-settings h3 { justify-content: flex-start; }
#it-trade h3 .seg { margin-left: auto; }
.mt-form fieldset, .is-form fieldset { margin: 0 0 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
.is-form fieldset { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.is-form .field span { font-size: 12.5px; min-height: 2.6em; display: flex; align-items: flex-end; }
.mt-form .form-foot, .is-form .form-foot { padding-top: 10px; gap: 10px; flex-wrap: wrap; }
.is-form .form-foot > span { margin-right: auto; max-width: 420px; }
.mt-quick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line-2); background: var(--raise); color: var(--muted); font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 99px; cursor: pointer; }
.chip-btn:hover { color: var(--text); border-color: var(--accent); }
.chip-btn b { color: var(--text); font-weight: 600; }
.mt-sum { margin-right: auto; font-size: 13.5px; color: var(--muted); }
.mt-sum b { color: var(--text); }
@media (max-width: 760px) {
  .mt-form fieldset { grid-template-columns: 1fr 1fr; }
  .mt-form fieldset .field:first-child { grid-column: 1 / -1; }
  .is-form fieldset { grid-template-columns: 1fr 1fr; }
  .is-form .field span { min-height: 0; }
}

/* favourites */
.fav-alert { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fav-alert input { width: 64px; height: 30px; padding: 0 8px; margin-left: 4px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.fav-alert input:focus { outline: none; border-color: var(--accent); }
.fav-alert .icon-btn { width: 30px; height: 30px; }
#favTable td.hit { color: var(--accent); font-weight: 700; }

/* phone access / updates */
.lan-box, .upd-box { grid-column: 1 / -1; }
.lan-box p { margin: 0 0 6px; }
.lan-on { display: flex; gap: 20px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--accent-soft); }
.lan-on .qr { width: 148px; height: 148px; border-radius: 8px; background: #fff; padding: 6px; flex: none; image-rendering: pixelated; }
.lan-on ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.big-link { font-size: 16px; font-weight: 600; color: var(--accent); word-break: break-all; }
.upd-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.upd-box > p { margin: 10px 0 0; display: flex; align-items: center; gap: 6px; }
.upd-box > p svg { width: 16px; height: 16px; flex: none; }
.upd-new { margin-top: 12px; padding: 14px; border-radius: var(--r); background: var(--green-soft); }
.upd-new > b { display: flex; align-items: center; gap: 8px; color: var(--green); }
.upd-new > b svg { width: 18px; height: 18px; }
.upd-notes { white-space: pre-wrap; font: inherit; font-size: 13px; color: var(--muted); max-height: 180px; overflow: auto; margin: 10px 0; }
.upd-btns { display: flex; gap: 8px; margin: 10px 0 6px; }
@media (max-width: 640px) { .lan-on { flex-direction: column; align-items: center; text-align: center; } .lan-on ul { text-align: left; } }
.dlg form.mt-form, .dlg form.is-form { padding: 0; max-width: none; }
.fav-alert { flex-wrap: nowrap; gap: 8px; }
.fav-alert input { width: 58px; }
#favTable td:nth-child(7) { min-width: 310px; }

/* ---------------------------------------------------- 15th iteration */
.head-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-btns .tabs { margin: 0; }
.tag.paper-tag { background: color-mix(in srgb, var(--c4) 18%, transparent); color: var(--c4); text-transform: none; letter-spacing: 0; height: 19px; font-size: 11px; margin-left: 4px; }
.acc-state .tag:not(.paper-tag) { background: var(--raise); color: var(--muted); text-transform: none; letter-spacing: 0; height: 19px; font-size: 11px; font-weight: 600; }
.acc-card.is-paper { border-style: dashed; }
.paper-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.paper-line svg { width: 14px; height: 14px; color: var(--c4); flex: none; }
.paper-line a { color: var(--muted); font-size: 12px; margin-left: auto; }
.acc-warn.sched { color: var(--blue); }
.strat { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; }
.strat.bad { border-color: var(--red); }
.strat summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.strat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.strat-grid .field { display: flex; flex-direction: column; justify-content: flex-end; }
.strat p { margin: 10px 0 0; }
[hidden] { display: none !important; }

.day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.day-chip { min-width: 44px; height: 34px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.day-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.day-chip.we:not(.on) { color: var(--faint); }
#schedNow svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

.dev-box { grid-column: 1 / -1; }
.dev-box > p { margin: 0 0 8px; }
.dev-box .neg svg { width: 14px; height: 14px; vertical-align: -2px; }
.dev-list { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--line); border-radius: var(--r); }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.dev-list li + li { border-top: 1px solid var(--line); }
.dev-list li > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.dev-list .grow { flex: 1; min-width: 0; }
.dev-list .tag.on-tag { margin: 0 0 0 6px; height: 19px; font-size: 11px; }

.rep-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.rep-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.rep-stat b { font-size: 22px; font-weight: 650; }
.rep-stat small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
#page-report .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-bottom: 16px; }
.neg-bars .fill { background: var(--red); }
.bars .row small { flex: none; }
.daily.hours { grid-template-columns: repeat(24, 1fr); gap: 3px; height: 140px; }
.daily.hours .col i { width: 80%; }
.daily.wdays { grid-template-columns: repeat(7, 1fr); height: 140px; }
.daily .day span:empty::after { content: "\00a0"; }
.sortable th[data-k] { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable th.sorted { color: var(--text); }
.sortable th.sorted::after { content: " ↓"; color: var(--accent); }
.sortable th.sorted[data-dir="asc"]::after { content: " ↑"; }

.login-wait { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 8px 0; }
.login-wait .spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1320px) { .rep-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .rep-stats { grid-template-columns: 1fr 1fr; }
  #page-report .grid-2 { grid-template-columns: 1fr; }
  .head-btns .tabs button { padding: 0 8px; }
}

/* ======================================================= 1.16: new blocks */

/* settings profiles */
.profile-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -6px 0 20px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.profile-bar > .h-ico { margin: 0; width: 20px; height: 20px; }
.pb-text { display: grid; line-height: 1.25; margin-right: auto; min-width: 150px; }
.pb-text small { color: var(--muted); font-size: 12.5px; }
.pb-text small b { color: var(--accent); font-weight: 600; }
.profile-bar select { height: 32px; min-width: 150px; font-size: 14px; }
@media (max-width: 760px) { .profile-bar .btn span { display: none; } .pb-text { width: 100%; } }

/* bot health on the account card */
.acc-health { margin: 8px 0 0; font-size: 12.5px; border-radius: var(--r); background: var(--raise); }
.acc-health summary { display: flex; align-items: center; gap: 7px; padding: 6px 9px; cursor: pointer; list-style: none;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.acc-health summary::-webkit-details-marker { display: none; }
.acc-health summary b { color: var(--text); font-weight: 600; }
.acc-health .hdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--green); }
.acc-health.h-ok .hdot { box-shadow: 0 0 0 3px var(--green-soft); }
.acc-health.h-warn .hdot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.acc-health.h-bad { background: var(--red-soft); }
.acc-health.h-bad .hdot { background: var(--red); animation: hbeat 1.4s ease-in-out infinite; }
@keyframes hbeat { 50% { transform: scale(1.5); opacity: .6; } }
.acc-health ul { margin: 0; padding: 0 9px 8px 24px; display: grid; gap: 3px; color: var(--muted); }
.acc-health[open] ul { animation: rise .2s ease-out; }
.acc-warn.target { color: var(--green); }
.acc-card.skel { min-height: 190px; border-style: dashed; }

/* token banner: expiring soon (not yet broken) */
#tokenBanner.soon { background: color-mix(in srgb, var(--accent) 9%, transparent); }
#tokenBanner a, #tokenBanner [data-act] { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* capital distribution */
.alloc { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.alloc h3 { font-size: 15px; margin: 0 0 14px; }
.ab-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; margin-bottom: 9px; }
.ab-t { font-size: 13px; color: var(--muted); }
.ab-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--raise); gap: 2px; }
.ab-bar i { display: block; height: 100%; transition: width .6s cubic-bezier(.2, .8, .2, 1); animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.alloc-tbl { width: 100%; border-collapse: collapse; margin: 14px 0 6px; font-size: 13.5px; }
.alloc-tbl th { font-weight: 500; color: var(--muted); font-size: 12.5px; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.alloc-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.alloc-tbl .r { text-align: right; }
.alloc-tbl .cmp-sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.alloc-tips { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.alloc-tips li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--raise); font-size: 14px; }
.alloc-tips li svg { width: 16px; height: 16px; margin-top: 2px; }
.alloc-tips .tip-move svg, .alloc-tips .tip-cap svg { color: var(--accent); }
.alloc-tips .tip-idle svg { color: var(--blue); }
.alloc-tips .tip-ok svg { color: var(--green); }
.alloc-tips .tip-info svg { color: var(--muted); }
@media (max-width: 760px) { .ab-row { grid-template-columns: 1fr; gap: 4px; } .alloc .table-wrap, .alloc-tbl { display: block; overflow-x: auto; } }

/* report: «don't buy» buttons */
.ban-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border: 1px solid var(--line-2); border-radius: 13px; background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.ban-btn svg { width: 13px; height: 13px; }
.ban-btn:hover { color: var(--red); border-color: var(--red); }
.ban-btn:active { transform: scale(.95); }
.ban-btn.sug { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.ban-btn.on { color: var(--red); background: var(--red-soft); border-color: transparent; }
.ban-btn.on:hover { color: var(--text); background: var(--raise); }

/* my trades on the item chart */
.mk { stroke: var(--surface); stroke-width: 1.2; cursor: pointer; transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.mk:hover { transform: scale(1.5); }
.mk.buy { fill: var(--green); }
.mk.sell { fill: var(--accent); }
.mk.sell.stop { fill: var(--red); }
.mk.sold { opacity: .55; }
.mk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.mk-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.mk-ico { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
.mk-ico.buy { border-bottom: 9px solid var(--green); }
.mk-ico.sell { border-top: 9px solid var(--accent); }
.mk-ico.stop { border-top: 9px solid var(--red); }
.mini-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); margin-right: auto; }
.mini-toggle input { accent-color: var(--accent); }

/* settings change log */
.hist-box .btn { margin-top: 10px; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.hist li { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 6px; }
.hist li:not(.hist-day):hover { background: var(--raise); }
.hist time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.hist .hist-day { display: block; padding: 10px 8px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hist .hist-day:first-child { padding-top: 0; }
.hist s { color: var(--faint); }
.hist b.acc { color: var(--accent); }
.hist small { white-space: nowrap; }
@media (max-width: 760px) { .hist li { grid-template-columns: 40px 1fr; } .hist small { grid-column: 2; } }

/* updater: failed tests */
.upd-tests { margin-top: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--red-soft); }
.upd-tests p { margin: 0 0 8px; }
.upd-tests pre { margin: 0 0 10px; max-height: 220px; overflow: auto; font: 12px/1.45 var(--mono); white-space: pre-wrap; color: var(--muted); }

/* ======================================================= 1.16: motion */

/* loading screen */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% 40%, color-mix(in srgb, var(--accent) 7%, var(--bg)), var(--bg));
  transition: opacity .5s ease, visibility .5s, transform .5s ease;
}
.boot.out { opacity: 0; visibility: hidden; transform: scale(1.04); pointer-events: none; }
.boot-in { display: grid; justify-items: center; gap: 14px; animation: rise .5s ease-out both; }
.boot-logo { width: 68px; height: 68px; color: var(--accent); overflow: visible; filter: drop-shadow(0 6px 22px color-mix(in srgb, var(--accent) 40%, transparent)); }
.boot-logo path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.boot-logo .bl-line { stroke-width: 2.6; animation: draw .5s .05s cubic-bezier(.6, 0, .2, 1) forwards, glow 2.2s .9s ease-in-out infinite; }
.boot-logo .bl-arrow { stroke-width: 2.6; animation: draw .25s .5s ease-out forwards; }
.boot-logo .bl-base { stroke-width: 2; opacity: .45; animation: draw .4s 0s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes glow { 50% { opacity: .55; } }
.boot-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.boot-bar { width: 220px; height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; position: relative; }
.boot-bar i { position: absolute; inset: 0 auto 0 0; width: 8%; border-radius: 2px; background: var(--accent); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.boot-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shine 1.1s linear infinite; }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.boot-text { font-size: 13px; color: var(--muted); min-height: 20px; }

/* the shell slides in when the loading screen goes away */
.ready .side { animation: slideR .5s cubic-bezier(.2, .8, .2, 1) both; }
.ready .bar { animation: slideD .45s .05s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes slideR { from { opacity: 0; transform: translateX(-14px); } }
@keyframes slideD { from { opacity: 0; transform: translateY(-10px); } }
@media (max-width: 760px) { .ready .side { animation: none; } }

/* top progress line for slow requests */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 90; pointer-events: none; opacity: 0; transition: opacity .3s; }
.topbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #fff)); box-shadow: 0 0 8px var(--accent); }
.topbar.on { opacity: 1; }
.topbar.on i { animation: load 8s cubic-bezier(.05, .7, .1, 1) forwards; }
.topbar.done i { width: 100%; animation: none; transition: width .2s; }
@keyframes load { from { width: 0; } 10% { width: 35%; } to { width: 92%; } }

/* page switch: blocks of the page appear one after another */
.page { animation: pageIn .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }
.page.entering > * { animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.page.entering > :nth-child(2) { animation-delay: .04s; }
.page.entering > :nth-child(3) { animation-delay: .08s; }
.page.entering > :nth-child(4) { animation-delay: .12s; }
.page.entering > :nth-child(5) { animation-delay: .16s; }
.page.entering > :nth-child(n+6) { animation-delay: .2s; }
.page.entering .acc-grid > * { animation: pop .45s cubic-bezier(.2, .8, .2, 1) both; }
.page.entering .acc-grid > :nth-child(2) { animation-delay: .05s; }
.page.entering .acc-grid > :nth-child(3) { animation-delay: .1s; }
.page.entering .acc-grid > :nth-child(4) { animation-delay: .15s; }
.page.entering .acc-grid > :nth-child(n+5) { animation-delay: .2s; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.page.entering .settings fieldset { animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.page.entering .settings fieldset:nth-of-type(2) { animation-delay: .04s; }
.page.entering .settings fieldset:nth-of-type(3) { animation-delay: .08s; }
.page.entering .settings fieldset:nth-of-type(n+4) { animation-delay: .12s; }

/* skeleton shimmer */
.skel { position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 6%, transparent) 50%, transparent 80%);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* cards and buttons */
.card, .acc-card { transition: border-color .2s, box-shadow .25s, transform .25s; }
.acc-card:not(.skel):hover { transform: translateY(-2px); box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .45); }
.btn { transition: background .12s, border-color .12s, transform .08s, box-shadow .2s, filter .12s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary:hover { box-shadow: 0 4px 16px -6px var(--accent); }
.icon-btn { transition: background .12s, color .12s, transform .08s; }
.icon-btn:active { transform: scale(.9); }

/* navigation: sliding accent marker */
.nav a { position: relative; }
.nav a::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent); transform: scaleY(0); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.nav a.on::before { transform: scaleY(1); }
.nav a svg { transition: transform .2s, color .15s; }
.nav a:hover svg { transform: translateX(2px); }

/* dialogs */
.dlg[open] { animation: dlgIn .22s cubic-bezier(.2, .8, .2, 1); }
.dlg[open]::backdrop { animation: fade .22s ease-out; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes fade { from { opacity: 0; } }

/* toasts slide in and out */
.toast { animation: toastIn .3s cubic-bezier(.2, .8, .2, 1); }
.toast.out { animation: toastOut .26s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* login page entrance */
.login-brand { animation: rise .5s ease-out both; }
.login-card { animation: pop .5s .08s cubic-bezier(.2, .8, .2, 1) both; }
.login-err:not([hidden]) { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .boot-logo path { stroke-dashoffset: 0; }
}
#repTable td:not(:first-child) { white-space: nowrap; }
#repTable td:first-child { min-width: 210px; }

/* ======================================================= 1.17: settings tabs, auto-fit */
.set-tabs {
  position: relative; display: flex; gap: 2px; margin: 0 0 22px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow-x: auto; scrollbar-width: none;
}
.set-tabs::-webkit-scrollbar { display: none; }
.set-tabs button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 38px; padding: 0 14px; border: 0; border-radius: var(--r); background: transparent;
  color: var(--muted); cursor: pointer; font-weight: 550; white-space: nowrap; transition: color .2s;
}
.set-tabs button svg { width: 16px; height: 16px; transition: transform .25s, color .2s; }
.set-tabs button:hover { color: var(--text); }
.set-tabs button:hover svg { transform: translateY(-1px); }
.set-tabs button.on { color: var(--text); }
.set-tabs button.on svg { color: var(--accent); }
.set-tabs button.bad::after { content: ""; position: absolute; top: 7px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.set-tabs-ink {
  position: absolute; left: 0; top: 4px; bottom: 4px; width: 0; border-radius: var(--r);
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), width .35s cubic-bezier(.2, .8, .2, 1);
}
.settings fieldset.tab-in { animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
.field.dim { opacity: .45; transition: opacity .2s; }
.field.dim:focus-within { opacity: 1; }
#moneyNote svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--accent); }
.acc-fit { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.acc-fit svg { width: 14px; height: 14px; flex: none; color: var(--blue); }
.acc-fit b { color: var(--text); font-weight: 600; }
@media (max-width: 760px) { .set-tabs button { padding: 0 11px; } }

/* ============================================================ 1.18 additions */

/* sidebar: groups, scrolling nav, quick search */
.side { overflow: hidden; }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav a { height: 36px; flex: none; }
.nav-group { flex: none; margin: 12px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.cmdk-open {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; margin: 0 0 12px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--raise); color: var(--faint);
  font: inherit; font-size: 13.5px; cursor: pointer; transition: border-color .15s, color .15s;
}
.cmdk-open:hover { border-color: var(--line-2); color: var(--muted); }
.cmdk-open svg { width: 16px; height: 16px; flex: none; }
.cmdk-open span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-open kbd { font-size: 11px; color: var(--faint); }

/* command palette */
.dlg.cmdk { width: min(600px, calc(100vw - 24px)); margin-top: 12vh; overflow: hidden; }
.cmdk-in { display: flex; flex-direction: column; max-height: min(560px, 72vh); }
.cmdk-q { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-q svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.cmdk-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 16px; padding: 0; height: auto; box-shadow: none; }
.cmdk-q kbd { font-size: 11px; color: var(--faint); }
.cmdk-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.cmdk-kind { padding: 10px 10px 4px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); cursor: pointer; }
.cmdk-item > svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.cmdk-item span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item small { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.cmdk-item.on { background: var(--accent-soft); }
.cmdk-item.on > svg { color: var(--accent); }
.cmdk-none { padding: 18px 12px; text-align: center; }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); }
.cmdk-foot kbd { margin-right: 3px; font-size: 11px; }
.dlg.cmdk[open] .cmdk-in { animation: rise .16s ease-out; }

/* account card: analysis progress */
.acc-prog { height: 4px; margin: 6px 0 2px; border-radius: 2px; background: var(--raise); overflow: hidden; }
.acc-prog i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #fff)); transition: width .6s ease; position: relative; }
.acc-prog i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* what-if dialog */
.dlg.dlg-wide { width: min(860px, calc(100vw - 24px)); }
.wi { padding: 20px 22px; }
.wi-sub { margin: 0 0 10px; }
.wi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.wi-chips .tag { background: var(--accent-soft); color: var(--text); }
.wi-table th { font-weight: 500; color: var(--muted); text-align: left; }
.wi-table td { font-variant-numeric: tabular-nums; }
.wi-table thead th { color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.wi-table tbody th { width: 38%; }
.wi-table .wi-why td { font-size: 12px; color: var(--muted); }
.wi-d { font-style: normal; font-size: 10px; margin-left: 4px; }
.wi-h { font-size: 14px; margin: 18px 0 6px; }
.wi-top { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 2px; }
.wi-top li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r); background: var(--raise); }
.wi-top .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wi-empty { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 12px; border-radius: var(--r); background: var(--accent-soft); font-size: 13.5px; }
.wi-empty svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.wi-load { display: flex; align-items: center; gap: 12px; padding: 28px 4px; color: var(--muted); }
.wi-load .spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.form-foot #whatifBtn { margin-left: auto; }

/* token security box */
.sec-line { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--raise); }
.sec-line > svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.sec-line.ok > svg { color: var(--green); }
.sec-line.warn > svg { color: var(--accent); }
.sec-line div { display: grid; gap: 4px; }
.sec-box p { margin: 0; }

/* export buttons: Excel + small CSV */
.btn.sm-link { padding: 0 12px; font-size: 12.5px; color: var(--muted); }

/* balance chart: hover readout */
.chart-tip { position: absolute; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .12s; transform: translateY(-100%);
  display: grid; gap: 1px; padding: 6px 10px; border-radius: var(--r); background: var(--text); color: var(--bg); font-size: 12.5px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.chart-tip small { opacity: .75; font-size: 11.5px; }
.chart-dot { position: absolute; z-index: 2; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: var(--surface); border: 2px solid var(--accent); transition: opacity .12s; }

/* mobile tab bar */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    position: fixed; z-index: 15; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    display: grid; justify-items: center; gap: 2px; padding: 6px 0 4px; border: 0; background: none; border-radius: var(--r);
    color: var(--faint); text-decoration: none; font: inherit; font-size: 11px; cursor: pointer;
  }
  .tabbar svg { width: 22px; height: 22px; transition: transform .2s; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on svg { transform: translateY(-1px) scale(1.06); }
  .main { padding-bottom: 92px; }
  .toasts { bottom: 84px; }
  .cmdk-open { display: none; }
  .dlg.cmdk { margin-top: 8px; }
  .bar .status { flex: 1; min-width: 0; }
  .wi { padding: 16px; }
  .wi-table tbody th { width: auto; }
  .side { padding-bottom: 90px; }
}

/* ---------------------------------------------------------------- 1.20 Telegram page */
.tg-col { display: grid; gap: 20px; align-content: start; min-width: 0; }
.tg-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.tg-hero > div { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px); padding: 14px 16px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.tgh-main { background: linear-gradient(120deg, color-mix(in srgb, #2aabee 16%, var(--surface)), var(--surface)) !important; }
.tgh-main > div { flex: 1; min-width: 0; display: grid; }
.tgh-main small, .tgh-stat small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.tgh-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); flex: none; }
.tgh-dot.ok { background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); animation: tghPulse 2s infinite; }
.tgh-dot.bad { background: var(--red); }
@keyframes tghPulse { 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.tgh-stat > svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.tgh-stat > div { display: grid; min-width: 0; }
.tgh-stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.tgh-stat small { color: var(--muted); }
@media (max-width: 1100px) { .tg-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tgh-main { grid-column: 1 / -1; } }

.tg-users { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.tg-user { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: var(--r); background: var(--raise); border: 1px solid transparent; transition: border-color .15s, transform .15s; }
.tg-user:hover { border-color: var(--line-2); }
.tg-user.owner { background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 10%, var(--raise)), var(--raise)); }
.tg-user .ava { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(140deg, hsl(var(--h) 70% 58%), hsl(calc(var(--h) + 30) 65% 44%)); }
.tg-user .ava svg { width: 18px; height: 18px; }
.tg-user .crown { position: absolute; right: -6px; top: -8px; font-style: normal; font-size: 14px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.tu-main { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; min-width: 0; }
.tu-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-main .tag { justify-self: start; height: 19px; font-size: 11px; }
.tu-main small { grid-column: 1 / -1; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tu-sws { grid-column: 2 / -1; display: flex; gap: 6px 18px; flex-wrap: wrap; }
.tu-sw { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.tu-sw .switch:disabled { opacity: .55; cursor: default; }
.tu-act { display: flex; gap: 2px; }
.tu-act .icon-btn { width: 30px; height: 30px; }
.tu-act .icon-btn.danger:hover { color: var(--red); }
.tg-users .empty { color: var(--faint); padding: 10px 0; }
.tg-users-note { margin: 14px 0 0; }
#tgUsersCard .card-head h2 .cnt { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 8px; border-radius: 99px; background: var(--raise); color: var(--muted); font-size: 12px; vertical-align: 2px; }
.tg-user .ava { grid-row: span 2; align-self: start; }
.tg-add { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); margin-bottom: 12px; line-height: 1.7; animation: fadeUp .25s ease; }
.tg-add > svg { width: 20px; height: 20px; flex: none; margin-top: 4px; color: var(--accent); }
.tg-add code.big { font-size: 18px; letter-spacing: 2px; padding: 2px 10px; font-weight: 700; }
.tg-add-act { display: flex; gap: 8px; margin: 6px 0 2px; flex-wrap: wrap; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* phone-like preview of the Telegram menu (Telegram dark colours on purpose) */
.tg-phone { background: #0e1621 radial-gradient(circle at 20% 0%, #1b2a3b 0%, transparent 60%); border-radius: 16px; padding: 16px 14px; display: grid; gap: 6px; justify-items: stretch; max-width: 440px; margin: 0 auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.tg-bubble { background: #182533; border-radius: 14px 14px 14px 4px; overflow: hidden; color: #e9edf1; font-size: 13.5px; line-height: 1.45; }
.tg-bubble video { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: #10141c; }
.tg-cap { padding: 8px 12px 8px; position: relative; min-height: 44px; }
.tg-cap b { color: #fff; }
.tg-time { float: right; margin: 6px 0 0 10px; font-size: 11px; color: #6d7f8f; }
.tg-kb { display: grid; gap: 5px; }
.tg-row { display: flex; gap: 5px; }
.tg-btn { flex: 1; min-width: 0; height: 36px; border: 0; border-radius: 8px; background: rgba(36, 54, 72, .92); color: #e9edf1; font: 600 12.5px/1 inherit; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; transition: filter .15s, transform .1s; }
.tg-btn:hover { filter: brightness(1.18); }
.tg-btn:active { transform: scale(.97); }
.tg-btn.primary { background: #2b6fb3; }
.tg-btn.success { background: #2f8f57; }
.tg-btn.danger { background: #b5443d; }
.tg-btn.on { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.tg-quiet { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.tg-quiet legend, .tg-quiet .toggle { grid-column: 1 / -1; }

/* What's new */
.news-spark { display: inline-block; animation: sparkle 2.4s ease-in-out infinite; }
@keyframes sparkle { 50% { transform: rotate(18deg) scale(1.15); } }
.news-sec { animation: fadeUp .35s ease both; animation-delay: var(--d); }
.news-sec h3 { font-size: 15px; margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.news-sec ul { margin: 0; padding: 0 0 0 4px; list-style: none; display: grid; gap: 8px; }
.news-sec li { position: relative; padding: 8px 12px 8px 30px; border-radius: var(--r); background: var(--raise); line-height: 1.55; font-size: 13.5px; }
.news-sec li::before { content: ""; position: absolute; left: 12px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
#newsBody { max-height: min(64vh, 620px); overflow: auto; padding-right: 4px; }
#verLine:hover { color: var(--accent); }
.news { padding: 20px 22px; } @media (max-width: 640px) { .news { padding: 16px; } }

/* ---------------------------------------------------------- profile (1.21) */

[data-accent="blue"]   { --accent: #5aa9ff; --accent-ink: #04121f; --accent-soft: rgba(90, 169, 255, .13); }
[data-accent="green"]  { --accent: #4cc38a; --accent-ink: #04160d; --accent-soft: rgba(76, 195, 138, .13); }
[data-accent="violet"] { --accent: #a78bfa; --accent-ink: #140b2b; --accent-soft: rgba(167, 139, 250, .14); }
[data-accent="red"]    { --accent: #f2706a; --accent-ink: #220605; --accent-soft: rgba(242, 112, 106, .13); }
[data-accent="teal"]   { --accent: #3cc6c0; --accent-ink: #031716; --accent-soft: rgba(60, 198, 192, .13); }
[data-accent="pink"]   { --accent: #f07ab8; --accent-ink: #24061a; --accent-soft: rgba(240, 122, 184, .13); }
[data-theme="light"][data-accent="blue"]   { --accent: #1f6fd1; --accent-ink: #fff; --accent-soft: #e3eefb; }
[data-theme="light"][data-accent="green"]  { --accent: #1d8a55; --accent-ink: #fff; --accent-soft: #e0f3e9; }
[data-theme="light"][data-accent="violet"] { --accent: #6d4fd8; --accent-ink: #fff; --accent-soft: #ece7fb; }
[data-theme="light"][data-accent="red"]    { --accent: #c8372f; --accent-ink: #fff; --accent-soft: #fbe4e2; }
[data-theme="light"][data-accent="teal"]   { --accent: #11857f; --accent-ink: #fff; --accent-soft: #def3f2; }
[data-theme="light"][data-accent="pink"]   { --accent: #c53b86; --accent-ink: #fff; --accent-soft: #fae3ef; }

.ava { --s: 32px; position: relative; flex: none; display: inline-grid; place-items: center; width: var(--s); height: var(--s);
  border-radius: 50%; overflow: hidden; background: var(--raise); box-shadow: 0 0 0 1px var(--line-2); }
.ava > svg, .ava > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ava.xl { --s: 84px; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent), 0 10px 30px rgba(0, 0, 0, .3); }

.user-box { gap: 4px; padding-left: 4px; }
.user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 0; border-radius: var(--r);
  background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s; }
.user-btn:hover { background: var(--raise); }
.user-btn:hover .ava { box-shadow: 0 0 0 2px var(--accent); }
.user-txt { min-width: 0; display: grid; line-height: 1.2; }
.user-txt b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-txt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-m { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.user-btn-m .ava { --s: 34px; }
@media (min-width: 761px) { .user-btn-m { display: none; } }

.pf-dlg { width: min(640px, calc(100vw - 24px)); }
.pf { padding: 20px 22px 22px; }
.pf-hero { display: flex; align-items: center; gap: 18px; padding: 14px 16px; margin: 4px 0 16px; border-radius: var(--r-lg);
  background: radial-gradient(400px 160px at 0% 0%, var(--accent-soft), transparent 70%), var(--raise); }
.pf-who { min-width: 0; display: grid; gap: 4px; }
.pf-name { font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-tabs { margin-top: 6px; flex-wrap: wrap; }
.pf-tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.pf-sec { animation: pfIn .25s ease both; }
@keyframes pfIn { from { opacity: 0; transform: translateY(6px); } }
.pf-row { display: flex; gap: 10px; align-items: flex-end; padding: 0; }
.pf-row .field { flex: 1; margin: 0; }
.pf-label { margin: 18px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pf-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pf form { padding: 0; }
.pf-tile { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 2px 8px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--muted); font: inherit; cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.pf-tile .ava { --s: 52px; }
.pf-tile small { font-size: 11px; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.pf-tile:hover { border-color: var(--line-2); transform: translateY(-2px); color: var(--text); }
.pf-tile.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.pf-tile.on .ava { box-shadow: 0 0 0 2px var(--accent); }
.pf-own { display: grid; grid-template-columns: 86px 86px 1fr; gap: 8px; align-items: center; }
.pf-own p { margin: 0 0 0 6px; }
.pf-up-ico svg { width: 20px; height: 20px; color: var(--accent); }
.pf-upload { border-style: dashed; }
.pf-accents { display: flex; flex-wrap: wrap; gap: 10px; }
.pf-acc { width: 34px; height: 34px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; }
.pf-acc i { width: 24px; height: 24px; border-radius: 50%; display: block; transition: transform .15s; }
.pf-acc:hover i { transform: scale(1.12); }
.pf-acc.on { border-color: var(--text); }
.sw-amber { background: #e8a33d; } .sw-blue { background: #3d8fe8; } .sw-green { background: #34b37a; } .sw-violet { background: #8b6cf0; }
.sw-red { background: #e2534b; } .sw-teal { background: #22aaa4; } .sw-pink { background: #e0619f; }
.pf-pwd { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); }
.pf-sess { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.pf-sess li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.pf-sess li svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.pf-sess li.cur { border-color: var(--accent); background: var(--accent-soft); }
.pf-sess li.cur svg { color: var(--accent); }
.pf-sess li div { display: grid; }
.pf-sess small { color: var(--muted); font-size: 12px; }
#pfSessions + .form-foot { flex-wrap: wrap; gap: 10px; }
@media (max-width: 640px) { .pf-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) {
  .pf { padding: 16px; }
  .pf-hero { flex-direction: column; text-align: center; }
  .pf-who { justify-items: center; width: 100%; }
  .pf-name { max-width: 100%; }
  .pf-row { flex-direction: column; align-items: stretch; }
  .pf-own { grid-template-columns: 1fr 1fr; }
  .pf-own p { grid-column: 1 / -1; margin: 0; }
  .pf-tile .ava { --s: 42px; }
  .pf-pwd { flex-direction: column; align-items: stretch; }
}

/* avatar motion */
.ava svg .a-spin { transform-box: view-box; transform-origin: 32px 32px; animation: avSpin 3s linear infinite; }
.ava svg .a-spin.slow { animation-duration: 6s; }
.ava svg .a-spin.rev { animation-duration: 4s; animation-direction: reverse; }
.ava svg .a-ping { animation: avPing 3s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.ava svg .a-flick { transform-box: fill-box; transform-origin: 50% 100%; animation: avFlick .9s ease-in-out infinite alternate; }
.ava svg .a-flick.d2 { animation-duration: .6s; animation-delay: -.3s; }
.ava svg .a-flip { transform-box: view-box; transform-origin: 32px 32px; animation: avFlip 2.6s ease-in-out infinite; }
.ava svg .a-beat { transform-box: fill-box; transform-origin: center; animation: avBeat 1.2s ease-in-out infinite; }
.ava svg .a-dash { stroke-dasharray: 100; animation: avDash 1.8s linear infinite; }
.ava svg .a-flash { animation: avFlash 2.4s steps(1) infinite; }
.ava svg .a-rain { animation: avRain .8s linear infinite; }
.ava svg .a-bob { animation: avBob 1.6s ease-in-out infinite alternate; }
.ava svg .a-stars { animation: avStars 3s linear infinite; }
.ava svg .a-drift { animation: avDrift 4s ease-in-out infinite alternate; }
@keyframes avSpin { to { transform: rotate(360deg); } }
@keyframes avPing { 0%, 15% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.3); } 60%, 100% { opacity: 0; transform: scale(1); } }
@keyframes avFlick { from { transform: scale(1, 1); } to { transform: scale(.92, 1.08) skewX(-3deg); } }
@keyframes avFlip { 0%, 30% { transform: scaleX(1); } 50% { transform: scaleX(.08); } 70%, 100% { transform: scaleX(1); } }
@keyframes avBeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes avDash { from { stroke-dashoffset: 100; } to { stroke-dashoffset: -100; } }
@keyframes avFlash { 0%, 55% { opacity: .25; } 58% { opacity: 1; } 62% { opacity: .3; } 66%, 80% { opacity: 1; } 84% { opacity: .25; } }
@keyframes avRain { from { transform: translateY(-4px); opacity: .2; } 50% { opacity: 1; } to { transform: translateY(4px); opacity: .1; } }
@keyframes avBob { from { transform: translateY(2px); } to { transform: translateY(-3px); } }
@keyframes avStars { from { transform: translateY(-8px); } to { transform: translateY(8px); } }
@keyframes avDrift { from { transform: translateX(0); } to { transform: translateX(-22px); } }
.ava svg .a-spin.fast { animation-duration: .7s; }
.ava svg .a-recoil { animation: avRecoil 2.4s ease-out infinite; }
.ava svg .a-muzzle { transform-box: fill-box; transform-origin: 0 50%; animation: avMuzzle 2.4s ease-out infinite; }
.ava svg .a-dust { animation: avDust 2.4s ease-out infinite; }
.ava svg .a-stream { animation: avStream .7s linear infinite; }
.ava svg .a-burn { transform-box: fill-box; transform-origin: 50% 0; animation: avBurn .16s ease-in-out infinite alternate; }
.ava svg .a-burn.d2 { animation-duration: .11s; }
.ava svg .a-smoke { animation: avSmoke 2.2s ease-out infinite; }
.ava svg .a-wave { animation: avWave 1.6s linear infinite; }
.ava svg .a-tracer { animation: avTracer .35s linear infinite; }
.ava svg .a-flash2 { animation: avFlash2 .35s steps(1) infinite; }
.ava svg .a-sweep { animation: avSweep 3s ease-in-out infinite alternate; }
.ava svg .a-blink { animation: avBlink 1s steps(1) infinite; }
.ava svg .a-boom { transform-box: view-box; transform-origin: 32px 32px; animation: avBoom 1.8s ease-out infinite; }
.ava svg .a-spark { transform-box: view-box; transform-origin: 32px 32px; animation: avSpark 1.8s ease-out infinite; }
.ava svg .a-drop { animation: avDrop 1.6s ease-in infinite; }
.ava svg .a-drop.d2 { animation-delay: -.8s; }
.ava svg .a-puff { transform-box: fill-box; transform-origin: center; animation: avPuff 1.6s ease-out infinite; }
.ava svg .a-twinkle { transform-box: fill-box; transform-origin: center; animation: avTwinkle 2s ease-in-out infinite; }
.ava svg .a-twinkle.d2 { animation-delay: -1s; }
.ava svg .a-cloud { animation: avCloud 6s linear infinite; }
@keyframes avRecoil { 0%, 70% { transform: translateX(0); } 72% { transform: translateX(-2.5px); } 85%, 100% { transform: translateX(0); } }
@keyframes avMuzzle { 0%, 70% { opacity: 0; transform: scale(.3); } 72% { opacity: 1; transform: scale(1.15); } 80% { opacity: .8; transform: scale(.9); } 86%, 100% { opacity: 0; transform: scale(.4); } }
@keyframes avDust { 0%, 72% { opacity: 0; transform: translateX(0); } 76% { opacity: 1; } 100% { opacity: 0; transform: translateX(-6px) translateY(-2px); } }
@keyframes avStream { from { transform: translateY(-12px); } to { transform: translateY(12px); } }
@keyframes avBurn { from { transform: scaleY(.8); } to { transform: scaleY(1.15); } }
@keyframes avSmoke { from { transform: translate(0, 3px); opacity: .2; } 30% { opacity: 1; } to { transform: translate(5px, -5px); opacity: 0; } }
@keyframes avWave { from { transform: translateX(0); } to { transform: translateX(16px); } }
@keyframes avTracer { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -10.5; } }
@keyframes avFlash2 { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes avSweep { from { transform: translateX(-9px); } to { transform: translateX(9px); } }
@keyframes avBlink { 0% { opacity: 1; } 50% { opacity: .2; } }
@keyframes avBoom { 0% { transform: scale(.35) rotate(0); opacity: 0; } 12% { transform: scale(1.12) rotate(8deg); opacity: 1; } 30% { transform: scale(.96) rotate(10deg); } 75% { opacity: 1; } 100% { transform: scale(1.04) rotate(14deg); opacity: .15; } }
@keyframes avSpark { 0% { transform: scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes avDrop { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(22px); opacity: 0; } }
@keyframes avPuff { 0%, 75% { transform: scale(.2); opacity: 0; } 85% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
@keyframes avTwinkle { 0%, 100% { transform: scale(.3) rotate(0); opacity: .2; } 50% { transform: scale(1.1) rotate(45deg); opacity: 1; } }
@keyframes avCloud { from { transform: translateX(-24px); } to { transform: translateX(70px); } }
@media (prefers-reduced-motion: reduce) { .ava svg * { animation: none !important; } }
.pf-dlg[open] { margin-top: max(16px, 5vh); }
.pf-dlg:focus { outline: none; }

/* auto-fit levels (1.22) */
.tier-table { grid-column: 1 / -1; }
.tier-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tier-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tier-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tier-table p { margin: 8px 0 0; }
.tier-chip { display: inline-block; padding: 0 6px; margin-right: 2px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; }

/* rights of panel users (1.22): anything marked with data-perm disappears when there is no such right */
body.no-trade [data-perm~="trade"], body.no-accounts [data-perm~="accounts"], body.no-items [data-perm~="items"],
body.no-scan [data-perm~="scan"], body.no-settings [data-perm~="settings"], body.no-log [data-perm~="log"],
body.no-admin [data-perm~="admin"] { display: none !important; }

/* users page */
.role-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: 0 0 18px; }
.role-strip > div { padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.role-strip b { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 14px; margin-bottom: 3px; }
.role-strip b svg { width: 15px; height: 15px; color: var(--accent); }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.user-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.user-card.skel { min-height: 170px; }
.user-card.off { opacity: .62; }
.user-card.owner { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface); }
.uc-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.uc-head .ava { --s: 46px; }
.uc-who { min-width: 0; flex: 1; }
.uc-who b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-who small { display: block; color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-role { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.uc-role.off { background: var(--raise); color: var(--muted); }
.uc-perms { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.uc-perms li { font-size: 12px; padding: 2px 8px; border-radius: 5px; background: var(--raise); color: var(--muted); }
.uc-perms li.none { background: none; padding-left: 0; color: var(--faint); }
.uc-meta { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.uc-meta b { color: var(--text); font-weight: 600; }
.uc-note { margin: 0; font-size: 12.5px; color: var(--faint); font-style: italic; overflow-wrap: anywhere; }
.uc-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.uc-btns .icon-btn:first-of-type { margin-left: auto; }
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); margin-right: 5px; vertical-align: 1px; }
.users-empty { grid-column: 1 / -1; text-align: center; padding: 34px 20px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); color: var(--muted); }
.users-empty svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: 8px; }
.users-empty p { margin: 4px 0 14px; }

#userDlg .settings { max-width: none; }
#userDlg fieldset { margin-bottom: 22px; }
.pwd-row { display: flex; gap: 8px; }
.pwd-row input { flex: 1; min-width: 0; font-family: var(--mono); }
.role-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.role-pick button { display: grid; gap: 3px; align-content: start; text-align: left; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; line-height: 1.35; cursor: pointer; transition: border-color .15s, background .15s; }
.role-pick button b { color: var(--text); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.role-pick button b svg { width: 14px; height: 14px; color: var(--accent); }
.role-pick button:hover { border-color: var(--line-2); }
.role-pick button.on { border-color: var(--accent); background: var(--accent-soft); }
.perm-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.perm-list label { display: flex; gap: 9px; align-items: flex-start; padding: 7px 8px; border-radius: var(--r); cursor: pointer; font-size: 13.5px; }
.perm-list label:hover { background: var(--raise); }
.perm-list label small { display: block; color: var(--faint); font-size: 12px; line-height: 1.35; }
.perm-list input { margin-top: 3px; accent-color: var(--accent); }
.perm-list.locked label { cursor: default; }
.perm-list.locked label:hover { background: none; }
.perm-list .acc-pick-empty { grid-column: 1 / -1; color: var(--faint); font-size: 13px; }
.acc-scope { margin-bottom: 4px; }
.acc-scope button { padding: 6px 12px; }
.cred { display: grid; gap: 8px; margin: 14px 0 4px; padding: 14px 16px; border-radius: var(--r); background: var(--raise); font-size: 14px; }
.cred div { display: flex; justify-content: space-between; gap: 12px; }
.cred span { color: var(--muted); }
.cred b { font-family: var(--mono); font-weight: 600; user-select: all; overflow-wrap: anywhere; text-align: right; }
.pf-note { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r); background: var(--raise); }
@media (max-width: 640px) {
  .role-pick { grid-template-columns: 1fr 1fr; }
  .perm-list { grid-template-columns: 1fr; }
  .user-grid { grid-template-columns: 1fr; }
}
/* one more menu item since 1.22 — keep the whole menu visible on laptop screens */
@media (max-height: 980px) { .nav a { height: 33px; } .nav-group { margin: 9px 10px 3px; } }
@media (max-height: 840px) { .nav a { height: 30px; } .nav-group { margin: 6px 10px 2px; } }
.acc-scope { justify-self: start; }
@media (max-width: 640px) { .role-strip { display: none; } }

/* login help (1.22.1) */
.login-help { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.login-help summary { cursor: pointer; color: var(--accent); width: fit-content; list-style: none; }
.login-help summary::-webkit-details-marker { display: none; }
.login-help summary::after { content: "›"; display: inline-block; margin-left: 6px; transition: transform .15s; }
.login-help[open] summary::after { transform: rotate(90deg); }
.login-help ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; line-height: 1.45; }
.login-help li { padding: 8px 10px; border-radius: var(--r); background: var(--raise); }
.login-help b { color: var(--text); font-weight: 600; }

/* administration (1.23) */
.adm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 14px; }
.adm-stats > div { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); }
.adm-stats svg { grid-row: span 2; width: 18px; height: 18px; padding: 8px; box-sizing: content-box; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.adm-stats b { font-size: 20px; line-height: 1.1; }
.adm-stats span { font-size: 12.5px; color: var(--muted); }
.adm-h { font-size: 17px; margin: 22px 0 12px; }
.tag.whose { background: var(--raise); color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; max-width: 140px; }
.tag.whose svg { width: 11px; height: 11px; flex: none; }
.acc-state .tag.whose { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-name .tag.whose { margin-left: 6px; height: 19px; font-size: 11px; vertical-align: 1px; }
.perm-list label small { display: block; }
@media (max-width: 900px) { .adm-stats { grid-template-columns: 1fr 1fr; } }

.uc-perms[data-uact] { cursor: pointer; }
.uc-perms[data-uact]:hover li:not(.none) { color: var(--text); background: var(--accent-soft, var(--raise)); }

/* ---------------------------------------------------------------- 1.25 polish */
/* money and counters don't jump when digits change */
.card b, td, .tag, .tgh-stat b, [data-gjn] { font-variant-numeric: tabular-nums; }
/* inputs: a soft glow instead of a bare border change */
input, select, textarea { transition: border-color .15s, box-shadow .15s, background .15s; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field.bad input { box-shadow: 0 0 0 3px var(--red-soft); }
/* keyboard users always see where they are */
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, [data-page]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* cards come alive a little under the mouse */
.card { transition: border-color .2s, box-shadow .2s; }
.card:hover { border-color: var(--line-2); box-shadow: 0 6px 24px -14px rgba(0, 0, 0, .45); }
/* tables: easier to follow a row */
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--accent-soft); }
/* thin scrollbars that match the theme */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::selection { background: var(--accent); color: var(--accent-ink); }
/* phones: bigger touch targets, no tiny text */
@media (max-width: 720px) {
  .btn { min-height: 40px; }
  .icon-btn { min-width: 38px; min-height: 38px; }
  input, select { font-size: 16px; }            /* iOS doesn't zoom into the field */
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, tbody tr, input, select, textarea { transition: none; }
}

/* flags and rarity (1.26) */
.flag { width: 18px; height: 12px; flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); vertical-align: -1px; }
.flag.sm { width: 15px; height: 10px; margin-right: 6px; }
.it .item .qdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.q0 { --q: #9a968e; } .q1 { --q: #c9c4ba; } .q2 { --q: #6fbf73; } .q3 { --q: #5e9fe8; }
.q4 { --q: #b07ae0; } .q5 { --q: #e8a33d; } .q6 { --q: #e97366; }
.qdot { color: var(--q); }
.it-tags .tag[class*=" q"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--q); }
.it-tags .tag[class*=" q"] b { color: var(--q); }
.it-tags .tag .flag { margin-right: 1px; }
.head-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-filters select { height: 36px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); }

/* ---------- 1.27: sortable headers, summary strips ---------- */
table.table[id]:not(.sortable):not(.cmp) thead th { cursor: pointer; user-select: none; }
table.table[id]:not(.sortable):not(.cmp) thead th:empty { cursor: default; }
table.table[id]:not(.sortable):not(.cmp) thead th:hover { color: var(--text); }
table.table thead th[data-sort="desc"]::after { content: " ↓"; color: var(--accent); }
table.table thead th[data-sort="asc"]::after { content: " ↑"; color: var(--accent); }
table.table thead th[data-sort="asc"], table.table thead th[data-sort="desc"] { color: var(--text); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-strip:empty { display: none; }
.stat-strip > div { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat-strip > div::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-2); }
.stat-strip > div.buy::before { background: var(--blue, #4c8dff); }
.stat-strip > div.sell::before, .stat-strip > div.pos::before { background: var(--green, #35c47c); }
.stat-strip > div.neg::before { background: var(--red, #ef5a5a); }
.stat-strip > div.pos b { color: var(--green, #35c47c); }
.stat-strip > div.neg b { color: var(--red, #ef5a5a); }
.stat-strip .label { font-size: 12px; color: var(--muted); }
.stat-strip b { font-size: 18px; font-weight: 700; }
.stat-strip small { font-size: 12px; color: var(--muted); font-weight: 500; }
@media (max-width: 700px) {
  .head-filters .search input { width: 100%; }
  .head-filters .search { flex: 1 1 180px; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 1.28: profit calendar, items of the week, sales period ---------- */
.dash-extra { margin-bottom: 16px; }
.cal { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto 1fr; gap: 4px 6px; }
.cal-m { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; font-size: 11px; color: var(--faint); height: 14px; }
.cal-m span { white-space: nowrap; overflow: visible; }
.cal-wd { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 10px; color: var(--faint); }
.cal-wd span { line-height: 1; display: flex; align-items: center; }
.cal-g { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.cal-g i, .cal-legend i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--line); min-width: 8px; }
.cal-g i.pad { background: transparent; }
.cal-g i:not(.pad):hover { outline: 2px solid var(--text); outline-offset: -1px; }
.cal-g i.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.c0 { background: var(--line) !important; }
.c1 { background: color-mix(in srgb, var(--green) 30%, var(--surface)) !important; }
.c2 { background: color-mix(in srgb, var(--green) 55%, var(--surface)) !important; }
.c3 { background: color-mix(in srgb, var(--green) 78%, var(--surface)) !important; }
.c4 { background: var(--green) !important; }
.c-neg { background: color-mix(in srgb, var(--red) 70%, var(--surface)) !important; }
.cal-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; font-size: 11px; color: var(--faint); }
.cal-legend i { width: 11px; min-width: 11px; }
.cal-legend span { margin: 0 4px; }
.wk { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wk li[data-item] { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.wk li[data-item]:hover { background: var(--surface-2, rgba(127,127,127,.08)); }
.wk .grow { flex: 1; min-width: 0; display: grid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk .grow small { font-size: 11px; }
.wk .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk .nm .flag { margin-right: 5px; vertical-align: -1px; }
.wk-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 8px 2px; }
.tabs-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.tabs-row .tabs { margin-bottom: 14px; }

/* ---------- 1.29: phone access, boot problems ---------- */
.boot-fail { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 9999; padding: 14px 16px; border-radius: 12px;
  background: #3a1d18; color: #ffd9d2; border: 1px solid #ec7b66; font: 14px/1.45 system-ui, sans-serif; }
.lan-btns { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.lan-help { margin: 8px 0; }
.lan-help summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.lan-help ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.tag.ok { color: var(--green); background: var(--green-soft); }
.tag.bad { color: var(--red); background: var(--red-soft); }
/* ---------- 1.35: trusted networks, panel certificate ---------- */
.lan-nets { margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); }
.lan-nets > b { display: flex; align-items: center; gap: 6px; }
.lan-nets > b svg { width: 16px; height: 16px; flex: none; }
.lan-nets > p { margin: 6px 0; }
.net-list { list-style: none; margin: 8px 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); }
.net-list li { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 6px 4px 12px; }
.net-list li + li { border-top: 1px solid var(--line); }
.net-list li .icon-btn { margin-left: auto; width: 32px; height: 32px; color: var(--muted); }
.net-list .tag { height: 19px; font-size: 11px; }
.net-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.net-add input { flex: 1 1 240px; min-width: 0; }
code.fp { display: inline-block; max-width: 100%; overflow-wrap: anywhere; font-size: 12px; }
@media (max-width: 640px) { .lan-on details, .lan-on ol { text-align: left; } }
@media (max-width: 700px) {
  .page-head { flex-wrap: wrap; row-gap: 10px; }
  .page-head .head-filters { width: 100%; }
  .page-head .head-filters .search { flex: 1 1 auto; }
  .stat-strip > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat-strip > div { padding: 10px 12px; }
  .stat-strip b { font-size: 16px; }
  .tabs-row { gap: 0; }
  .tabs-row .tabs { margin-bottom: 8px; overflow-x: auto; max-width: 100%; }
  .table .it .hash { display: none; }
  /* phones: only what matters in the wide tables, the rest is in the item card (tap the name) */
  #salesTable th:nth-child(3), #salesTable td:nth-child(3),
  #salesTable th:nth-child(4), #salesTable td:nth-child(4),
  #salesTable th:nth-child(5), #salesTable td:nth-child(5) { display: none; }
  #ordersTable th:nth-child(2), #ordersTable td:nth-child(2),
  #ordersTable th:nth-child(4), #ordersTable td:nth-child(4),
  #ordersTable th:nth-child(5), #ordersTable td:nth-child(5) { display: none; }
  #invTable th:nth-child(2), #invTable td:nth-child(2),
  #invTable th:nth-child(4), #invTable td:nth-child(4),
  #invTable th:nth-child(5), #invTable td:nth-child(5) { display: none; }
  .table td, .table th { padding-left: 8px; padding-right: 8px; }
  .cal-g i, .cal-legend i { min-width: 0; border-radius: 2px; }
  .cal-g, .cal-m { gap: 2px; }
  #favTable th:nth-child(5), #favTable td:nth-child(5),
  #favTable th:nth-child(6), #favTable td:nth-child(6) { display: none; }
  /* an empty table: no header row (its nowrap titles made the table wider than the screen and cut the hint) */
  .table:has(.empty-row) thead { display: none; }
  .table .empty-row td { white-space: normal; padding: 28px 14px; }
}

/* security centre (Settings → Вход и телефон) */
.sec-box, .sess-box { grid-column: 1 / -1; }
.sec-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.sec-head b { display: block; font-size: 16px; }
.sec-head small { display: block; margin-top: 2px; }
.sec-ring { width: 64px; height: 64px; flex: none; }
.sec-ring circle { fill: none; stroke-width: 6; }
.sec-ring .bg { stroke: var(--line); }
.sec-ring .fg { stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.sec-ring.ok .fg { stroke: var(--green); } .sec-ring.mid .fg { stroke: var(--accent); } .sec-ring.bad .fg { stroke: var(--red); }
.sec-ring text { font-size: 17px; font-weight: 700; fill: var(--text); }
.sec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sec-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--raise); }
.sec-list li > svg { width: 18px; height: 18px; flex: none; }
.sec-list li > div { flex: 1; min-width: 0; }
.sec-list li b { font-weight: 550; font-size: 13.5px; }
.sec-list li small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.sec-list li.ok > svg { color: var(--green); }
.sec-list li.bad { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.sec-list li.bad > svg { color: var(--red); }
.sec-list li.mid > svg, .sec-list li.info > svg { color: var(--accent); }
.sess-log-head { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap; }
.sess-log-head .tabs { margin: 0; }
.sess-log-head .tabs button { height: 28px; font-size: 13px; }
.sess-log-head .tabs .n { color: var(--faint); margin-left: 3px; }
.sess-log-head #secLogClear { margin-left: auto; }
.sec-log td, .sec-log th { font-size: 13px; }
.sec-log .neg-row td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.dev-list li.cur { background: var(--accent-soft); }
.warn-banner { background: var(--red-soft); }
.warn-banner svg { color: var(--red); }
.warn-banner code { font-size: 12.5px; }
@media (max-width: 700px) {
  .sec-log th:nth-child(5), .sec-log td:nth-child(5), .sec-log th:nth-child(6), .sec-log td:nth-child(6) { display: none; }
  .sec-list li { flex-wrap: wrap; }
}

/* ---------------------------------------------------------- «Без минуса» & market chances (dashboard) */
.dash-guard { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); margin-bottom: 16px; }
.card-head h2 .h-ico { margin-right: 8px; }
.nl-card { position: relative; overflow: hidden; }
.nl-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--green), var(--c2)); opacity: .85; }
.nl-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px 3px 8px; border-radius: 99px; }
.nl-pill svg { width: 13px; height: 13px; }
.nl-pill.on { color: var(--green); background: var(--green-soft); }
.nl-pill.off { color: var(--red); background: var(--red-soft); }
.nl-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nl-st { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--raise); transition: transform .15s, border-color .15s; }
.nl-st:hover { transform: translateY(-1px); border-color: var(--line-2); }
.nl-st > svg { flex: none; width: 30px; height: 30px; padding: 6px; border-radius: 8px; color: var(--green); background: var(--green-soft); }
.nl-st.warn > svg { color: var(--accent); background: var(--accent-soft); }
.nl-st div { display: grid; min-width: 0; line-height: 1.25; }
.nl-st b { font-size: 18px; }
.nl-st span { font-size: 12.5px; color: var(--muted); }
.nl-st small { font-size: 11.5px; color: var(--faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.nl-note { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.nl-note b { color: var(--text); }
.nl-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chance { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chance li[data-item] { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.chance li[data-item]:hover { background: var(--raise); }
.chance .grow { flex: 1; min-width: 0; display: grid; }
.chance .nm, .chance .grow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chance .grow small { font-size: 11px; }
.chance .nm .flag { margin-right: 5px; vertical-align: -1px; }
.chance-p { display: grid; justify-items: end; line-height: 1.2; }
.chance-p small { font-size: 11px; color: var(--green); }
.chance-empty { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: 13px; }
.chance-empty svg { flex: none; width: 22px; height: 22px; color: var(--accent); }

/* orders: break-even button */
.even-btn { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 8px; font-size: 11.5px; color: var(--green); border-color: var(--green); }
.even-btn svg { width: 12px; height: 12px; }
.stat-strip .pos b { color: var(--green); }
.stat-strip .neg b { color: var(--red); }

/* settings: «Без минуса» example table */
.nl-set { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.nl-example { display: grid; gap: 6px; }
.nl-tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.nl-tbl th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--faint); padding: 4px 8px; border-bottom: 1px solid var(--line); }
.nl-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.nl-tbl tr:last-child td { border-bottom: 0; }
.nl-example p { margin: 0; }
.nl-stop { grid-column: 1 / -1; margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }

/* fee calculator */
.calc .h-ico { width: 18px; height: 18px; }
.calc-in { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 12px; }
.calc-in label:last-child { grid-column: 1 / -1; }
.calc-out { display: grid; gap: 8px; min-height: 60px; }
.calc-row { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line); animation: calc-in .2s ease-out; }
.calc-row span { font-size: 13px; color: var(--muted); }
.calc-row b { font-size: 18px; grid-row: span 2; align-self: center; }
.calc-row b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.calc-row > small { font-size: 12px; }
.calc-row.pos { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.calc-row.pos b { color: var(--green); }
.calc-row.neg b { color: var(--red); }
@keyframes calc-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .dash-guard { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .nl-stats { grid-template-columns: 1fr; }
  .calc-in { grid-template-columns: 1fr; }
  #ordersTable td:nth-child(7), #ordersTable th:nth-child(7) { display: none; }
}

/* Telegram: animated icons and stickers */
.tgi { display: grid; gap: 10px; margin-bottom: 14px; }
.tgi-meter { height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; }
.tgi-meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: 3px; transition: width .4s ease; }
.tgi-line { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tgi-line b { color: var(--text); }
.tgi-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tgi-chips span, .tgi-stk { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--raise); color: var(--text); }
.tgi-err { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--red, #e5484d) 10%, transparent); color: var(--text); }
.tgi-err svg { width: 18px; height: 18px; flex: none; color: var(--red, #e5484d); margin-top: 1px; }
.tgi-err code { word-break: break-word; }
.tgi-steps { font-size: 13.5px; }

/* ---------------------------------------------------- own stickers (1.33) */
.stk-lead { margin: -4px 0 12px; }
.stk-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stk-tile { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 7px; border: 1px solid var(--line);
  border-radius: 14px; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--accent) 9%, var(--raise)), var(--surface));
  color: var(--muted); font: 600 11.5px/1.2 var(--font); cursor: pointer; transition: transform .18s cubic-bezier(.3,1.6,.5,1), border-color .15s, box-shadow .15s; }
.stk-tile video, .stk-tile img { width: 76px; height: 76px; object-fit: contain; pointer-events: none; }
.stk-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stk-tile:hover { transform: translateY(-3px) scale(1.04); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--text);
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 70%, transparent); }
.stk-tile:active { transform: scale(.96); }
.stk-tile.sending { animation: stk-fly .6s ease; }
@keyframes stk-fly { 40% { transform: translateY(-10px) rotate(-6deg) scale(1.06); } 100% { transform: none; } }
.stk-pack { display: grid; gap: 10px; padding: 12px; border-radius: 12px; background: var(--raise); margin-bottom: 6px; }
.stk-pack-info { display: flex; gap: 10px; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.stk-pack-info b { color: var(--text); }
.stk-pack-info > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--accent); }
.stk-pack-info code { word-break: break-word; }
.stk-pack-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.stk-prem { display: inline-block; margin-top: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.stk-prem.ok { color: var(--green); background: var(--green-soft); }
.stk-sub { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--muted); margin: 16px 0 8px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; }
.stk-sub .tag { text-transform: none; letter-spacing: 0; }
.stk-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.stk-ev { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  transition: background .15s, border-color .15s; }
.stk-ev:hover { background: var(--raise); }
.stk-ev.on { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); background: color-mix(in srgb, var(--green) 6%, transparent); }
.stk-ev-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; font-size: 20px; }
.stk-ev-ico img { width: 34px; height: 34px; object-fit: contain; filter: saturate(.35) opacity(.6); transition: filter .2s, transform .2s; }
.stk-ev.on .stk-ev-ico img { filter: none; transform: rotate(-4deg); }
.stk-ev-txt { display: grid; min-width: 0; flex: 1; }
.stk-ev-txt b { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stk-ev-txt b .tag { height: 17px; font-size: 10.5px; padding: 0 5px; background: var(--accent-soft); color: var(--accent); }
.stk-ev-txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stk-emoji { display: flex; flex-wrap: wrap; gap: 4px; }
.stk-emoji span { width: 30px; height: 30px; display: grid; place-items: center; }
.stk-emoji video, .stk-emoji img { width: 28px; height: 28px; }
.stk-more { margin: 10px 0 4px; font-size: 13.5px; }
.stk-more summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.stk-more summary:hover { color: var(--text); }
.stk-more[open] summary { margin-bottom: 8px; }
.tg-ico { width: 17px; height: 17px; vertical-align: -3.5px; margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .stk-tile, .stk-tile.sending { animation: none; transition: none; } }
.stk-pop { position: fixed; right: 26px; bottom: 96px; width: 150px; height: 150px; z-index: 55; pointer-events: none;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .28)); }
.stk-pop video, .stk-pop img { width: 100%; height: 100%; object-fit: contain; }
.stk-pop.in { animation: stk-in .55s cubic-bezier(.3, 1.55, .5, 1) both; }
.stk-pop.out { animation: stk-out .38s ease forwards; }
@keyframes stk-in { from { transform: translateY(46px) scale(.35) rotate(-14deg); opacity: 0; } }
@keyframes stk-out { to { transform: translateY(24px) scale(.55) rotate(6deg); opacity: 0; } }
@media (max-width: 760px) { .stk-pop { width: 112px; height: 112px; right: 14px; bottom: 150px; } }
#stkPopBtn.on svg { color: var(--accent); }

/* ---------------------------------------------------------- 1.34: achievements, market moves, small chips */
.mv-card { display: flex; flex-direction: column; }
.ach-count { font-size: 12.5px; color: var(--muted); padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); }
.ach-count b { color: var(--accent); font-size: 13.5px; }
.ach-meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: -4px 0 12px; }
.ach-meter i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .8s cubic-bezier(.2, .8, .2, 1);
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffd36b)); }
.ach-streak { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 8px 11px; border-radius: 10px; margin-bottom: 12px;
  background: color-mix(in srgb, #f97316 9%, transparent); border: 1px solid color-mix(in srgb, #f97316 22%, transparent); }
.ach-streak svg { width: 18px; height: 18px; flex: none; color: #f97316; animation: flicker 1.8s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 50% { transform: scale(1.12) rotate(-4deg); } }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px 4px; }
.ach { display: grid; justify-items: center; gap: 4px; padding: 6px 2px 4px; border: 0; background: none; border-radius: 10px; cursor: pointer;
  color: var(--faint); font: inherit; transition: background .15s, transform .15s; }
.ach:hover { background: var(--raise); transform: translateY(-1px); }
.ach:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ach-e { --p: 0; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); }
.ach-e > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: var(--surface); filter: grayscale(1); opacity: .45; }
.ach.on .ach-e { background: radial-gradient(circle at 30% 25%, #fff3c4, #f5b942 55%, #c77d12); box-shadow: 0 3px 12px color-mix(in srgb, #f5b942 35%, transparent); }
.ach.on .ach-e > span { filter: none; opacity: 1; background: color-mix(in srgb, var(--surface) 82%, #ffe7a3); }
.ach-t { font-size: 10.5px; line-height: 1.2; text-align: center; max-width: 72px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ach.on .ach-t { color: var(--text); font-weight: 600; }
.ach-sub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 14px 0 6px; font-weight: 600; }
.ach-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ach-next li { display: flex; align-items: center; gap: 10px; }
.ach-next .ach-e.sm { width: 34px; height: 34px; flex: none; background: var(--raise); }
.ach-next .ach-e.sm > span { width: 30px; height: 30px; font-size: 16px; filter: none; opacity: 1; background: none; }
.ach-next .grow { flex: 1; min-width: 0; display: grid; }
.ach-next .grow b { font-size: 13px; }
.ach-next .grow small { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.ach-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform-origin: left; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.ach-v { font-size: 12px; color: var(--muted); white-space: nowrap; }

.mv-mood { font-size: 12.5px; color: var(--muted); }
.mv-lead { margin: -6px 0 10px; }
.mv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.mv-h { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 4px; }
.mv-h svg { width: 16px; height: 16px; }
.mv-h.up { color: var(--green); }
.mv-h.down { color: var(--red); }
.mv { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mv li[data-item] { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.mv li[data-item]:hover { background: var(--raise); }
.mv .grow { flex: 1; min-width: 0; display: grid; }
.mv .nm, .mv .grow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv .nm { font-size: 13px; }
.mv .nm .flag { margin-right: 5px; vertical-align: -1px; }
.mv .grow small { font-size: 11px; }
.mv-r { display: grid; justify-items: end; gap: 2px; flex: none; }
.mv-held { font-size: 10.5px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.mv-dist { margin: 0 0 14px; }
.mv-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); gap: 2px; }
.mv-bar i { display: block; height: 100%; min-width: 2px; transform-origin: left; animation: grow .8s cubic-bezier(.2, .8, .2, 1) both; }
.mv-bar i.up { background: var(--green); }
.mv-bar i.flat { background: var(--line-2); }
.mv-bar i.down { background: var(--red); }
.mv-legend { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.mv-legend .up { color: var(--green); }
.mv-legend .down { color: var(--red); }
.mv-chip { font-size: 12px; font-variant-numeric: tabular-nums; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.mv-chip.up { color: var(--green); background: var(--green-soft); }
.mv-chip.down { color: var(--red); background: var(--red-soft); }
.mv-empty { font-size: 12.5px; color: var(--muted); padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; }
.mv-warn { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; margin: auto 0 0; padding: 9px 11px; border-radius: 10px;
  background: var(--red-soft); color: var(--text); }
.mv-warn svg { width: 16px; height: 16px; flex: none; color: var(--red); margin-top: 2px; }
@media (max-width: 1100px) { .mv-cols { grid-template-columns: 1fr; } }

/* prices page: how much the price jumps; account card: what «Точная цена» has saved */
.vol-chip { display: inline-block; min-width: 46px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 99px; }
.vol-chip.lo { color: var(--green); background: var(--green-soft); }
.vol-chip.mid { color: var(--accent); background: var(--accent-soft); }
.vol-chip.hi { color: var(--red); background: var(--red-soft); }
.tight-gain { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 600; white-space: nowrap; }
.tight-gain svg { width: 13px; height: 13px; }

/* hero chart: the last point glows, the lowest and the highest values are signed */
.worth-chart .chart-last { position: absolute; animation-delay: .9s; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; pointer-events: none;
  background: var(--lc, var(--green)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc, var(--green)) 25%, transparent); animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--lc, var(--green)) 0%, transparent); } }
.worth-chart .chart-mm { position: absolute; right: 2px; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; pointer-events: none; }
.worth-chart .chart-mm.hi { top: -2px; }
.worth-chart .chart-mm.lo { bottom: -2px; }
@media (prefers-reduced-motion: reduce) {
  .ach-streak svg, .worth-chart .chart-last, .ach-bar i, .mv-bar i { animation: none; }
}

/* 1.35.2 — polish: themed thin scrollbars, selection, no ring around whole dialogs, a calm «wait» note on item cards */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--text); }
dialog:focus, dialog:focus-visible { outline: none; }          /* the controls inside still get their focus ring */
.it-wait { display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px; border-radius: var(--r); font-size: 13.5px;
  background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); }
.it-wait svg { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }
.it-wait b { font-variant-numeric: tabular-nums; }
@media (forced-colors: active) {
  .it-wait, .it-warn, .toast { border: 1px solid CanvasText; }
}

/* 1.36 — «Аналитика»: KPI strip with a win-rate ring, equity curve with the deepest drawdown, profit calendar, breakdowns, advice */
.nav-new { margin-left: auto; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 650; line-height: 16px;
  background: var(--accent); color: var(--accent-ink); letter-spacing: .02em; animation: newPulse 2.6s ease-in-out infinite; }
@keyframes newPulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); } }

.an-kpis { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-kpi { position: relative; overflow: hidden; align-content: start; }
.an-kpi b .unit, .an-kpi b .of { font-size: 13px; font-weight: 500; color: var(--faint); margin-left: 4px; }
.an-kpi.an-hero { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.an-kpi.an-hero b { font-size: 28px; letter-spacing: -.02em; }
.an-kpi.an-hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); pointer-events: none; }
.an-ring-wrap { display: flex; align-items: center; gap: 10px; }
.an-ring { width: 34px; height: 34px; flex: none; transform: rotate(-90deg); }
.an-ring circle { fill: none; stroke-width: 3.8; }
.an-ring .bg { stroke: var(--raise); }
.an-ring .fg { stroke: var(--green); stroke-linecap: round; animation: ringIn 1s cubic-bezier(.4, 0, .2, 1); }
.an-ring .fg.low { stroke: var(--red); }
@keyframes ringIn { from { stroke-dasharray: 0 100; } }

.an-tips-card { margin-bottom: 16px; }
.an-tips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.an-tip { --tc: var(--blue); display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r); font-size: 13.5px; line-height: 1.45;
  background: color-mix(in srgb, var(--tc) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tc) 22%, transparent); border-left: 3px solid var(--tc); }
.an-tip svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--tc); }
.an-tip.bad { --tc: var(--red); }
.an-tip.warn { --tc: var(--accent); }
.an-tip.good { --tc: var(--green); }
.an-tips:empty::before { content: "Советов пока нет — нужно больше продаж за период."; color: var(--faint); font-size: 13px; }

.an-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.an-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.an-row > .card { min-width: 0; }
.an-row .card-head { gap: 10px; flex-wrap: wrap; }

.an-row > .card.an-eq-card { display: flex; flex-direction: column; }
.an-eq-card .an-equity { flex: 1 1 auto; height: auto; min-height: 210px; }
.an-eq-card .an-equity svg { position: absolute; inset: 0; }
.an-equity { height: 210px; position: relative; }
.an-equity svg { width: 100%; height: 100%; display: block; overflow: visible; }
.an-equity .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.an-equity .chart-mm { position: absolute; right: 2px; font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; pointer-events: none; }
.an-equity .chart-mm.hi { top: -2px; }
.an-equity .chart-mm.lo { bottom: -2px; }
.an-equity .an-zero { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 4 4; }
.an-equity .an-peak { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 4; opacity: .8; }
.an-equity .an-dd { fill: var(--red-soft); stroke: color-mix(in srgb, var(--red) 35%, transparent); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }

.an-legend { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--faint); }
.an-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.an-legend i:first-of-type { margin-left: 4px; }
.an-legend i:last-of-type { margin-right: 4px; }
.an-cal i, .an-legend i { background: var(--raise); }
.an-cal i.l-0, .an-legend .l-0 { background: color-mix(in srgb, var(--faint) 35%, var(--raise)); }
.an-cal i.l-1, .an-legend .l-1 { background: color-mix(in srgb, var(--green) 32%, var(--raise)); }
.an-cal i.l-2, .an-legend .l-2 { background: color-mix(in srgb, var(--green) 62%, var(--raise)); }
.an-cal i.l-3, .an-legend .l-3 { background: var(--green); }
.an-cal i.neg, .an-legend .l-neg { background: color-mix(in srgb, var(--red) 45%, var(--raise)); }
.an-cal i.neg.strong { background: var(--red); }
.an-cal i.pad { background: transparent; }
.an-cal i[title] { cursor: default; transition: transform .12s, box-shadow .12s; }
.an-cal i[title]:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-2); position: relative; z-index: 1; }
.an-cal > .empty { display: grid; place-items: center; height: 120px; color: var(--faint); font-size: 13px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.an-cal.month .an-cal-head, .an-cal.month .an-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.an-cal.month .an-cal-head { margin-bottom: 5px; font-size: 11.5px; color: var(--faint); text-align: center; }
.an-cal.month i { position: relative; min-height: 44px; border-radius: 7px; padding: 4px 6px; display: flex; flex-direction: column; justify-content: space-between; font-style: normal; overflow: hidden; }
.an-cal.month i em { font-style: normal; font-size: 11px; color: color-mix(in srgb, var(--text) 72%, transparent); line-height: 1; }
.an-cal.month i small { font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.an-cal.month i.l-3 em, .an-cal.month i.l-3 small, .an-cal.month i.strong em, .an-cal.month i.strong small { color: var(--bg); }
.an-cal.year { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; }
.an-cal.year .an-cal-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; font-size: 10px; color: var(--faint); line-height: 1; }
.an-cal.year .an-cal-days span { display: flex; align-items: center; }
.an-cal.year .an-cal-grid { display: grid; grid-template-rows: repeat(7, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 26px); gap: 3px; overflow-x: auto; padding: 2px; }
.an-cal.year i { aspect-ratio: 1; border-radius: 3px; min-width: 6px; }
.an-cal-sum { margin: 12px 0 0; }

.an-groups { display: grid; gap: 14px; }
.an-g { display: grid; gap: 5px; font-size: 13.5px; }
.an-g-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.an-g-top .grow { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-g-top small { flex: none; }
.an-g > small { font-size: 12px; }
.an-g-bar { height: 6px; border-radius: 3px; background: var(--raise); overflow: hidden; }
.an-g-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, color-mix(in srgb, var(--green) 60%, transparent), var(--green));
  transform-origin: left; animation: barGrow .7s cubic-bezier(.4, 0, .2, 1); }
.an-g-bar.neg i { background: linear-gradient(90deg, color-mix(in srgb, var(--red) 60%, transparent), var(--red)); }
@keyframes barGrow { from { transform: scaleX(0); } }

#page-analytics .bars .row > img, #page-analytics .bars .row > .thumb { flex: none; }
#page-analytics > p.muted.small { max-width: 980px; line-height: 1.6; }

@media (max-width: 1320px) {
  .an-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .an-row.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-row.three > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .an-row, .an-row.three { grid-template-columns: minmax(0, 1fr); }
  .an-row.three > :last-child { grid-column: auto; }
}
@media (max-width: 760px) {
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .an-kpi.an-hero { grid-column: 1 / -1; }
  .an-kpi.an-hero b { font-size: 24px; }
  .an-tips { grid-template-columns: minmax(0, 1fr); }
  .an-equity, .an-eq-card .an-equity { height: 170px; min-height: 170px; }
  .an-cal.month i { min-height: 36px; padding: 3px 4px; }
  .an-cal.month i small { display: none; }
  #page-analytics .head-btns { width: 100%; justify-content: flex-start; }
  #page-analytics .tabs { overflow-x: auto; max-width: 100%; }
  #page-analytics .tabs button { flex: none; padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-new, .an-ring .fg, .an-g-bar i { animation: none; }
  .an-cal i[title] { transition: none; }
}
@media (forced-colors: active) {
  .an-cal i, .an-legend i, .an-g-bar i { forced-color-adjust: none; }
  .an-tip { border: 1px solid CanvasText; }
}

/* 1.36 — toasts: click to close, a counter for repeats, never a wall of them */
.toast { cursor: pointer; }
.toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .toast-n { flex: none; font-size: 12px; font-weight: 650; opacity: .7; font-variant-numeric: tabular-nums; }
.toast .toast-n:empty { display: none; }
.toast:hover { box-shadow: 0 8px 26px rgba(0, 0, 0, .28); }
.hero-stats .hero-more { align-self: center; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-size: 13px; text-decoration: none;
  transition: color .15s, border-color .15s, background .15s; }
.hero-stats .hero-more svg { width: 15px; height: 15px; color: var(--accent); }
.hero-stats .hero-more:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); background: var(--accent-soft); }

/* ============================================================ 1.37 design pass */

/* contrast: the faintest text (group titles, hints, placeholders) was below 3:1 on the cards */
[data-theme="light"] { --faint: #878075; }
[data-theme="dark"] { --faint: #847f77; }

/* «Как начать»: the dashboard of a new installation — steps instead of empty charts */
#page-overview.fresh .dash-later, #page-overview.noacc #worthSplit, #page-overview.noacc #worthMeter { display: none; }
.start-card { margin-bottom: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)), var(--surface) 60%); }
.start-progress { font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 10px; border-radius: 999px; }
.start-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: none; }
.start-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--r); transition: background .15s; }
.start-steps li.now { background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 6px 18px -12px rgba(0, 0, 0, .35); }
.start-steps li b { display: block; font-weight: 620; }
.start-steps li small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.start-steps li.done b { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.start-steps li.done small { display: none; }
.ss-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 650;
  border: 1.5px solid var(--line-2); color: var(--muted); background: var(--surface); }
.ss-dot svg { width: 16px; height: 16px; }
.start-steps li.done .ss-dot { border-color: transparent; background: var(--green-soft); color: var(--green); }
.start-steps li.now .ss-dot { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.start-note { margin: 12px 12px 0; }
@media (max-width: 640px) {
  .start-steps li { grid-template-columns: 28px minmax(0, 1fr); }
  .start-steps li .btn { grid-column: 2; justify-self: start; }
}

/* sidebar: on short screens (laptops ~ 768–940 px high) the whole menu fits without scrolling */
@media (min-width: 761px) and (max-height: 940px) {
  .side { padding-top: 14px; padding-bottom: 12px; }
  .brand { padding-bottom: 14px; }
  .cmdk-open { height: 34px; margin-bottom: 8px; }
  .nav a { height: 32px; }
  .nav-group { margin: 8px 10px 2px; }
  .side-foot { padding-top: 8px; }
}
@media (min-width: 761px) and (max-height: 820px) {
  .side { padding-top: 10px; padding-bottom: 8px; }
  .brand { padding-bottom: 8px; }
  .brand-sub { display: none; }
  .cmdk-open { height: 30px; margin-bottom: 4px; }
  .nav { gap: 1px; }
  .nav a { height: 28px; font-size: 14px; }
  .nav-group { margin: 5px 10px 1px; font-size: 10.5px; }
  .side-foot { padding-top: 4px; }
  .user-box { padding: 6px 0 6px 8px; }
}

/* cards: one rhythm for headings and a softer lift on hover where the card is clickable */
.card-head h2 { letter-spacing: -.01em; }
.card { transition: border-color .15s, box-shadow .2s; }
.card:hover { border-color: var(--line-2); }
.banner { border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.warn-banner { border-color: color-mix(in srgb, var(--red) 22%, transparent); }

/* phones: compact header and banners — the content starts higher */
@media (max-width: 760px) {
  .banner { margin-top: 10px; padding: 8px 12px; font-size: 13px; line-height: 1.4; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
  .banner > span { flex: 1 1 200px; min-width: 0; }
  .banner a { margin-left: 26px; }
  .banner code { font-size: .85em; padding: 0 3px; }
  .page-head h1 { font-size: 24px; }
  .card { padding: 14px 14px; }
  .start-card { margin-bottom: 14px; }
}
@media (max-width: 640px) { .start-steps li { align-items: start; } .start-steps li .ss-dot { margin-top: 2px; } }

/* ---------------------------------------------------------------- 1.38 */
/* a tag with no colour of its own (e.g. «Не настроен») is a soft grey pill, not bare bold text */
.tag:not([class*=" "]) { background: var(--raise); color: var(--muted); }
.tag.warn { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* login: show / hide password, Caps Lock hint, a button that says it is working */
.field > .pass-wrap { position: relative; display: block; font-size: inherit; color: var(--text); }
.pass-wrap input { width: 100%; box-sizing: border-box; padding-right: 44px; }
.pass-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; background: none; color: var(--faint); border-radius: var(--r); cursor: pointer; }
.pass-eye:hover { color: var(--text); background: var(--raise); }
.pass-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pass-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pass-eye .eye-off { opacity: 1; transition: opacity .15s; }
.pass-eye[aria-pressed="true"] .eye-off { opacity: 0; }
.pass-eye[aria-pressed="true"] { color: var(--accent); }
.login-caps { font-size: 13px; color: var(--accent); background: var(--accent-soft); padding: 7px 12px; border-radius: var(--r); }
.btn .btn-spin { display: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: spin .8s linear infinite; margin-right: 8px; }
.btn.loading .btn-spin { display: inline-block; }
.btn.loading { cursor: progress; }

/* keyboard users: «к содержимому» link and the current section announced */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--r);
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; transition: top .15s; }
.skip-link:focus { top: 12px; }

/* Telegram page: the state pill reads at a glance */
#tgState { height: 24px; padding: 0 10px; border-radius: 999px; }
#tgState::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }

@media (prefers-reduced-motion: reduce) {
  .btn .btn-spin { animation-duration: 2s; }
  .skip-link { transition: none; }
}
.main:focus { outline: none; }

/* ------------------------------------------------------------ server */
.srv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.srv-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: grid; gap: 6px; }
.srv-kpi .k-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 550; }
.srv-kpi .k-head svg { width: 16px; height: 16px; }
.srv-kpi .k-val { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.srv-kpi .k-sub { color: var(--muted); font-size: 12.5px; min-height: 1.3em; }
.srv-bar { height: 7px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.srv-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--green); transition: width .5s ease, background .3s; }
.srv-bar.mid i { background: #e0a526; }
.srv-bar.bad i { background: var(--red); }
.srv-kpi.bad { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.srv-chart-card { margin-bottom: 16px; }
.srv-chart { height: 170px; position: relative; display: grid; grid-template-columns: 38px 1fr; }
.srv-ax { position: relative; height: calc(100% - 18px); font-size: 11px; color: var(--muted); }
.srv-ax span { position: absolute; left: 0; transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.srv-plot { display: grid; grid-template-rows: 1fr 18px; min-width: 0; }
.srv-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.srv-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); align-items: end; }
.srv-chart > .empty { grid-column: 1 / -1; }
.srv-chart .grid line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.srv-chart .l-cpu { stroke: var(--accent); fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.srv-chart .l-ram { stroke: var(--blue); fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.srv-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.srv-legend span::before { content: ''; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.srv-legend .lg-cpu::before { background: var(--accent); }
.srv-legend .lg-ram::before { background: var(--blue); }
.srv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.srv-dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 16px; margin: 0; font-size: 13.5px; }
.srv-dl dt { color: var(--muted); }
.srv-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.srv-dl code { font-size: 12px; }
.srv-disk { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.srv-disk:last-child { border-bottom: 0; }
.srv-disk .d-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.srv-disk .d-top small { color: var(--muted); }
.srv-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.srv-core { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.srv-core b { color: var(--text); font-variant-numeric: tabular-nums; }
.srv-cmds { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; }
.srv-wait { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(3px); }
.srv-wait > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 26px; display: grid; gap: 8px; max-width: 420px; text-align: center; }
.srv-wait b { font-size: 16px; }
@media (max-width: 1100px) { .srv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 1.39.0: health checks on the server page */
.srv-health-card { margin-bottom: 16px; }
.srv-health-card .card-head .small { font-size: 12px; }
.srv-health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.srv-hc { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); min-width: 0; }
.srv-hc .hdot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 4px; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.srv-hc.warn .hdot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.srv-hc.bad .hdot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); animation: hbeat 1.4s ease-in-out infinite; }
.srv-hc.off .hdot { background: var(--muted); box-shadow: none; }
.srv-hc b { display: block; font-size: 13.5px; }
.srv-hc .hc-st { font-size: 12.5px; font-weight: 600; }
.srv-hc.bad .hc-st { color: var(--red); }
.srv-hc .hc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .srv-health { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .srv-health { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .srv-grid { grid-template-columns: 1fr; } .srv-kpi .k-val { font-size: 23px; } .srv-chart { height: 140px; } }

/* ============================================================ 1.39 — design pass */

/* shell: soft accent glow behind the content, glassier sidebar */
[data-theme="dark"] body:not(.login-page) {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(232, 163, 61, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(134, 175, 224, .05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="light"] body:not(.login-page) {
  background: radial-gradient(1200px 600px at 100% -10%, rgba(184, 110, 18, .06), transparent 60%), var(--bg);
  background-attachment: fixed;
}
.brand-mark {
  padding: 5px; border-radius: 9px; box-sizing: border-box;
  background: linear-gradient(140deg, var(--accent-soft), transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* navigation: an accent bar on the open page */
.nav a { position: relative; }
.nav a.on { background: linear-gradient(90deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, transparent)); font-weight: 560; }
.nav a.on::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px;
  border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.nav a svg { transition: transform .15s; }
.nav a:hover svg { transform: translateX(1px); }

/* cards: a thin light edge on top, a calm hover */
.card, .acc-card:not(.add), .table-wrap {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 1px 2px rgba(0, 0, 0, .12);
  transition: border-color .18s, box-shadow .18s;
}
[data-theme="light"] .card, [data-theme="light"] .acc-card:not(.add), [data-theme="light"] .table-wrap {
  box-shadow: 0 1px 2px rgba(60, 40, 10, .05), 0 4px 14px rgba(60, 40, 10, .04);
}
.card:hover, .acc-card:not(.add):hover { border-color: var(--line-2); }

/* buttons */
.btn { border-radius: 10px; }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 6px 18px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255, 255, 255, .2) inset, 0 8px 22px color-mix(in srgb, var(--accent) 36%, transparent); }

/* page titles */
h1 { font-weight: 700; letter-spacing: -.025em; }
.page-head h1 {
  background: linear-gradient(180deg, var(--text) 40%, color-mix(in srgb, var(--text) 70%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* inputs: a soft accent ring on focus */
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* thin scrollbars that match the theme */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* login: a glowing card, Telegram help */
.login-page {
  background:
    radial-gradient(700px 420px at 50% -5%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(134, 175, 224, .08), transparent 70%),
    var(--bg);
}
.login { width: min(420px, 100%); }
.login-brand .brand-mark { width: 40px; height: 40px; padding: 7px; border-radius: 12px; }
.login-brand .brand-name { font-size: 18px; }
.login-card {
  position: relative; overflow: hidden; padding: 30px 28px 24px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.login-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.login-card h1 { font-size: 24px; }
.login-card .btn.primary { height: 46px; font-size: 15px; }
.login-tg { display: grid; gap: 12px; padding-top: 16px; }
.login-tg-row { display: flex; gap: 12px; align-items: flex-start; }
.login-tg-row b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.login-tg-row span { font-size: 13px; line-height: 1.45; }
.login-tg-ico {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: rgba(42, 171, 238, .14); color: #2aabee;
}
.login-tg-ico svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.login-card .btn.tg-btn {
  height: 42px; width: 100%; text-decoration: none; color: #fff; border: 0;
  background: linear-gradient(180deg, #37b6f2, #229ed9);
  box-shadow: 0 6px 18px rgba(34, 158, 217, .28);
}
.login-card .btn.tg-btn:hover { filter: brightness(1.06); background: linear-gradient(180deg, #37b6f2, #229ed9); }
.login-card .btn.tg-btn svg { width: 17px; height: 17px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .nav a svg, .card, .btn { transition: none; }
}

/* ------------------------------------------------ 1.39 — заявки на восстановление */
.nav-count {
  position: absolute; left: 21px; top: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; line-height: 1;
  background: var(--red); color: #fff; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--red-soft);
  animation: recPulse 2.4s ease-in-out infinite;
}
.nav-count[hidden] { display: none; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 7px transparent; } }
.rec-card { margin-bottom: 8px; display: grid; gap: 14px; }
.rec-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rec-head .toggle { align-self: center; height: auto; }
.rec-title { display: flex; gap: 14px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.rec-title h2 { margin: 0 0 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-title p { margin: 0; max-width: 70ch; }
.rec-ico {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.rec-ico svg { width: 21px; height: 21px; }
.rec-count {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px;
  background: var(--red-soft); color: var(--red); letter-spacing: .01em;
}
.rec-count[hidden] { display: none; }
.rec-warn {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: 13.5px;
  background: var(--red-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
}
.rec-warn.ok { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.rec-warn svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--red); }
.rec-warn.ok svg { color: var(--green); }
.rec-warn a { color: var(--accent); font-weight: 600; }
.rec-warn[hidden] { display: none; }
.rec-filter { display: inline-flex; gap: 4px; padding: 4px; border-radius: 11px; background: var(--raise); justify-self: start; }
.rec-filter button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: background .12s, color .12s;
}
.rec-filter button:hover { color: var(--text); }
.rec-filter button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.rec-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.rec-item {
  display: grid; gap: 10px; align-content: start; padding: 14px 16px; border-radius: 14px;
  background: var(--raise); border: 1px solid var(--line); position: relative; overflow: hidden;
}
.rec-item.new { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: linear-gradient(180deg, var(--accent-soft), var(--raise) 70%); }
.rec-item.new::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.rec-top { display: flex; align-items: center; gap: 8px; }
.rec-top > :last-child { margin-left: auto; }
.rec-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-status { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.rec-status.s-new { background: var(--accent-soft); color: var(--accent); }
.rec-status.s-done { background: var(--green-soft); color: var(--green); }
.rec-status.s-rejected { background: var(--red-soft); color: var(--red); }
.rec-who { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.rec-who > svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: #2aabee; }
.rec-who a { color: #2aabee; text-decoration: none; }
.rec-who a:hover { text-decoration: underline; }
.rec-login { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rec-login > span:first-child { flex-basis: 100%; }
.rec-login b { font-size: 16px; overflow-wrap: anywhere; }
.rec-match { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.rec-match svg { width: 13px; height: 13px; }
.rec-match.ok { background: var(--green-soft); color: var(--green); }
.rec-match.bad { background: var(--red-soft); color: var(--red); }
.rec-note {
  margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-style: italic; overflow-wrap: anywhere;
  background: var(--surface); border-left: 3px solid var(--line-2); color: var(--muted);
}
.rec-res { margin: 0; }
.rec-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 2px; }
.rec-btns .icon-btn { margin-left: auto; }
.rec-btns .btn.primary { flex: 1 1 auto; }
.rec-pick {
  flex: 1 1 100%; height: 36px; padding: 0 10px; border-radius: 9px; font: inherit; font-size: 13.5px;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
}
.rec-empty {
  grid-column: 1 / -1; display: grid; justify-items: center; gap: 4px; text-align: center;
  padding: 26px 16px; border-radius: 14px; border: 1px dashed var(--line-2); color: var(--muted);
}
.rec-empty > svg { width: 26px; height: 26px; color: var(--green); margin-bottom: 4px; }
.rec-empty b { color: var(--text); }
.rec-dlg { width: min(480px, calc(100vw - 24px)); padding: 20px 22px; }
.rec-dlg-body { display: grid; gap: 14px; }
.rec-dlg-body .form-foot { padding-top: 16px; gap: 10px; }
.rec-done { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); }
.rec-done.warn { background: var(--red-soft); }
.rec-done > svg { grid-row: span 2; width: 22px; height: 22px; color: var(--green); margin-top: 2px; }
.rec-done.warn > svg { color: var(--red); }
.rec-done span { font-size: 13px; color: var(--muted); }
.rec-cred { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; padding: 14px; border-radius: 12px; background: var(--raise); }
.rec-cred span { color: var(--muted); font-size: 13px; }
.rec-cred code { font-size: 16px; font-weight: 700; user-select: all; overflow-wrap: anywhere; }
.login-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.login-steps b { color: var(--text); }
.login-steps[hidden] { display: none; }
@media (max-width: 600px) { .rec-list { grid-template-columns: 1fr; } .rec-head .toggle { width: 100%; } }
.login-help .login-steps { counter-reset: st; list-style: none; padding: 0; gap: 6px; }
.login-help .login-steps li { counter-increment: st; display: flex; gap: 10px; align-items: center; padding: 0; background: none; }
.login-help .login-steps li::before {
  content: counter(st); flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 11.5px; font-weight: 700; color: #2aabee; background: rgba(42, 171, 238, .13);
}

/* ============================================================ 1.39 — design pass 2 (full) */

/* settings: every block is a card, the form uses the width */
#settingsForm { max-width: 1040px; }
#settingsForm fieldset {
  position: relative; margin: 0 0 18px; padding: 18px 22px 22px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03), 0 1px 2px rgba(0, 0, 0, .1);
}
#settingsForm fieldset > legend {
  float: left; width: 100%; grid-column: 1 / -1; margin: 0 0 2px; padding: 0 0 12px;
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px;
}
#settingsForm fieldset > legend .h-ico {
  width: 28px; height: 28px; padding: 6px; border-radius: 8px; box-sizing: border-box;
  background: var(--accent-soft); color: var(--accent);
}
#settingsForm fieldset > legend small { margin-left: 0; }
#settingsForm .form-foot {
  position: sticky; bottom: 14px; z-index: 3; margin-top: 4px; padding: 10px 12px; gap: 10px;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(12px);
  border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}
[data-theme="light"] #settingsForm .form-foot { box-shadow: 0 10px 30px rgba(60, 40, 10, .12); }
[data-theme="light"] #settingsForm fieldset { box-shadow: 0 1px 2px rgba(60, 40, 10, .05), 0 4px 14px rgba(60, 40, 10, .04); }

/* settings tabs and the other tab strips: one pill style */
.tabs { padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--raise) 70%, transparent); width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { border-radius: 9px; font-weight: 550; transition: background .15s, color .15s, box-shadow .15s; }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .2), inset 0 0 0 1px var(--line); }
[data-theme="light"] .tabs button.on { box-shadow: 0 1px 3px rgba(60, 40, 10, .12); }
.tabs-row .tabs { margin-bottom: 0; }

/* tables: calmer head, soft zebra, a clear hover */
.table-wrap { border-radius: 14px; }
.table th {
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--faint);
  background: color-mix(in srgb, var(--raise) 55%, transparent);
}
.table tbody tr:nth-child(even):not(.empty-row) td { background: color-mix(in srgb, var(--raise) 28%, transparent); }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.table.cmp th { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

/* tags: pills */
.tag { border-radius: 99px; padding: 0 9px; letter-spacing: .01em; }

/* top bar: glass with a hairline glow */
.bar { background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(14px) saturate(1.3); }
.bar::after {
  content: ""; position: absolute; left: 40px; right: 40px; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 45%, transparent), transparent);
  opacity: .5;
}

/* sidebar: group labels, the user block */
.nav-group { letter-spacing: .1em; font-weight: 700; opacity: .85; }
.side { border-right-color: color-mix(in srgb, var(--line) 80%, transparent); }
.nav a { font-weight: 500; }
.nav a:hover { background: color-mix(in srgb, var(--raise) 80%, transparent); }

/* dialogs: blurred backdrop, rounder, a head line */
.dlg { border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .04); }
.dlg::backdrop { background: rgba(10, 9, 8, .55); backdrop-filter: blur(4px); }
[data-theme="light"] .dlg::backdrop { background: rgba(40, 32, 20, .28); }
.dlg-head h2 { letter-spacing: -.01em; }

/* toasts: glass cards with a coloured edge */
.toast {
  background: color-mix(in srgb, var(--surface) 94%, transparent); color: var(--text);
  border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 12px;
  backdrop-filter: blur(10px); box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

/* stat tiles and cards: a gentle lift */
#admStats > div, .user-card, .acc-card:not(.add), .rec-item { transition: transform .18s, box-shadow .18s, border-color .18s; }
#admStats > div:hover, .user-card:hover, .rec-item:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.card-head h2, .card > h2 { letter-spacing: -.01em; }

/* toggles: a glow when on */
.toggle input:checked + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.toggle i { transition: background .15s, box-shadow .15s; }

/* inputs: one height, rounder */
.field input, .field select, .field textarea { border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
.field input:hover:not(:focus), .field select:hover:not(:focus) { border-color: var(--line-2); }

/* keyboard focus everywhere */
a:focus-visible, button:focus-visible, .btn:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

@media (max-width: 860px) {
  #settingsForm fieldset { padding: 14px 14px 16px; border-radius: 14px; }
  .bar::after { left: 16px; right: 16px; }
  .tabs { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #admStats > div, .user-card, .acc-card, .rec-item, .tabs button, .toggle i { transition: none; }
  #admStats > div:hover, .user-card:hover, .rec-item:hover { transform: none; }
  .nav-count { animation: none; }
}

.login-card .btn.tg-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-bot { display: block; margin-top: -4px; text-align: center; font-size: 12px; color: var(--faint); overflow-wrap: anywhere; }

/* ------------------------------------------------ 1.39.0 — login, recovery and Telegram binding cards */
.login-card { gap: 14px; }
.login-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.login-head h1 { margin: 0; }
.net-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--raise); border: 1px solid var(--line);
  white-space: nowrap; transition: color .2s, background .2s, border-color .2s;
}
.net-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.net-pill[data-state="ok"] { color: var(--green); background: var(--green-soft); border-color: transparent; }
.net-pill[data-state="ok"] i { animation: netBeat 2.4s ease-in-out infinite; box-shadow: 0 0 0 0 var(--green); }
.net-pill[data-state="down"] { color: var(--red); background: var(--red-soft); border-color: transparent; }
.net-pill[data-state="wait"] i { animation: glow 1s ease-in-out infinite; }
@keyframes netBeat { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

.flow-step { display: grid; gap: 12px; }
.flow-step[hidden] { display: none; }
.flow-in { animation: flowIn .32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes flowIn { from { opacity: 0; transform: translateX(12px); } }
.flow-step p { margin: 0; line-height: 1.5; }
.flow-note { font-size: 13px; line-height: 1.5; padding: 10px 12px; border-radius: var(--r); background: var(--raise); }
.flow-note.warn { color: var(--text); background: color-mix(in srgb, #f0b43c 14%, transparent); border: 1px solid color-mix(in srgb, #f0b43c 35%, transparent); }
.flow-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; line-height: 1.5; }
.flow-list li { padding: 9px 12px; border-radius: var(--r); background: var(--raise); color: var(--muted); }
.flow-list b { color: var(--text); }
.flow-step code, .flow-login code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 6px; background: var(--raise); color: var(--text); word-break: break-all; }
.flow-wait { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; color: var(--muted); padding: 4px 0; }
.flow-wait[hidden] { display: none; }
.spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.code-input { font-family: var(--mono); font-size: 24px !important; letter-spacing: .45em; text-align: center; height: 52px !important; }
.flow-login { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r); background: var(--accent-soft); }
.flow-login code { font-size: 15px; background: transparent; padding: 0; font-weight: 700; }
#nwFields { display: grid; gap: 12px; }
#nwFields[hidden] { display: none; }
.flow-done { justify-items: center; text-align: center; padding: 6px 0 2px; }
.flow-done b { font-size: 17px; }
.done-mark { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); animation: pop .45s cubic-bezier(.2, .8, .2, 1) both; }
.done-mark svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26; stroke-dashoffset: 26; animation: draw .5s .2s ease-out forwards; }
.flow-done .btn { width: 100%; }
.flow-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.flow-foot[hidden] { display: none; }
.linkish { background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; color: var(--accent); cursor: pointer; text-decoration: none; }
.linkish:hover { text-decoration: underline; }
.linkish:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.linkish[hidden] { display: none; }
.login-card .btn.ghost { height: 40px; font-size: 13.5px; }
.login-card .btn.loading .btn-label { opacity: .8; }

/* «Не помню логин или пароль ˅» — a compact menu under the button */
.forgot { justify-self: stretch; text-align: center; margin-top: 2px; }
.forgot summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px;
  font-size: 13px; color: var(--muted); transition: color .15s, background .15s; user-select: none;
}
.forgot summary::-webkit-details-marker { display: none; }
.forgot summary:hover, .forgot[open] summary { color: var(--text); background: var(--raise); }
.forgot summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.forgot .chev { display: inline-block; font-size: 15px; line-height: 1; transition: transform .2s; transform: translateY(-2px); }
.forgot[open] .chev { transform: rotate(180deg) translateY(-1px); }
.forgot-menu {
  display: grid; gap: 2px; margin-top: 8px; padding: 6px; border-radius: 12px; text-align: left;
  background: color-mix(in srgb, var(--raise) 70%, transparent); border: 1px solid var(--line);
  animation: menuIn .22s cubic-bezier(.2, .8, .2, 1) both; transform-origin: top center;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.forgot-menu button {
  display: grid; gap: 2px; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font: inherit; cursor: pointer; transition: background .12s;
}
.forgot-menu button:hover, .forgot-menu button:focus-visible { background: var(--surface); outline: none; }
.forgot-menu b { font-size: 13.5px; font-weight: 600; }
.forgot-menu small { font-size: 12px; color: var(--muted); }

/* the binding page keeps the login look */
.bind-card .field input { height: 44px; }

@media (max-width: 480px) {
  .login-page { padding: 16px 12px; align-items: start; padding-top: 6vh; }
  .login-card { padding: 22px 18px 18px; }
  .login-card h1 { font-size: 21px; }
  .flow-login { grid-template-columns: 1fr; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-in, .forgot-menu, .done-mark, .done-mark svg, .net-pill i { animation: none !important; }
  .done-mark svg { stroke-dashoffset: 0; }
}

/* profile → Telegram (1.39.0) */
.pf-tg { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.pf-tg > div { flex: 1; min-width: 0; }
.pf-tg b { font-size: 15px; }
.pf-tg-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(42, 171, 238, .14); color: #2aabee; }
.pf-tg-ico svg { width: 20px; height: 20px; fill: currentColor; }
.pf-tg-opts { display: grid; gap: 10px; margin: 6px 0 10px; }
@media (max-width: 560px) { .pf-tg { flex-wrap: wrap; } .pf-tg .btn { width: 100%; } }

/* users → Telegram, security journal (1.39.0) */
.uc-warn { color: #e0a43a; }
#usersTgWarn { margin-bottom: 12px; }
.sec-journal { margin-top: 18px; display: grid; gap: 10px; }
.sj-list { display: grid; gap: 4px; max-height: 420px; overflow: auto; }
.sj-row { display: grid; grid-template-columns: 130px minmax(160px, 1.2fr) 1fr; gap: 4px 12px; align-items: baseline; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.sj-row:nth-child(odd) { background: var(--raise); }
.sj-row time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sj-row span { color: var(--muted); overflow-wrap: anywhere; }
.sj-row small { grid-column: 2 / -1; color: var(--faint, var(--muted)); font-size: 12px; overflow-wrap: anywhere; }
.sj-row[data-ev^="password"] b, .sj-row[data-ev^="tg_"] b { color: var(--accent); }
.sj-row[data-ev$="refused"] b, .sj-row[data-ev$="wrong"] b, .sj-row[data-ev$="denied"] b { color: var(--red); }
@media (max-width: 640px) { .sj-row { grid-template-columns: 1fr; } .sj-row small { grid-column: 1; } }

/* emergency stop / Dry Run (1.39.0) */
.estop-btn { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: transparent; }
.estop-btn:hover { background: var(--red-soft); }
.estop-btn.on { background: var(--red); color: #fff; border-color: transparent; animation: estopPulse 2s ease-in-out infinite; }
@keyframes estopPulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--red) 25%, transparent); } }
.estop-banner { font-weight: 600; }
.dry-banner { background: color-mix(in srgb, #3c8df0 14%, transparent); border-color: color-mix(in srgb, #3c8df0 30%, transparent); }
.dry-banner svg { color: #3c8df0; }
.safety { display: grid; gap: 14px; }
.dlg > .safety { padding: 20px 22px; }
.safety .dlg-head { margin-bottom: 0; }
.safety-box { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--line); }
.safety-box[hidden] { display: none; }
.safety-box p { margin: 0; line-height: 1.5; }
.safety-box.on { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.safety .btn.sf-big { height: 44px; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .estop-btn.on { animation: none; } }

/* ============================================================ 1.39 — design pass 3 */

/* wider screens get wider pages (banners follow the page) */
@media (min-width: 1600px) { .page, .banner { max-width: 1280px; } }
@media (min-width: 1900px) { .page, .banner { max-width: 1400px; } }
#settingsForm { max-width: none; }

/* sidebar: the request counter is a small badge on the icon corner, it never covers the label */
.nav a .nav-count {
  left: 22px; top: 3px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px;
  font-size: 9.5px; font-weight: 750; animation: none;
  box-shadow: 0 0 0 2px var(--surface);
}
.nav a { min-width: 0; white-space: nowrap; }
.side { overflow-x: hidden; }
.nav-new {
  font-size: 10px; font-weight: 650; letter-spacing: .02em; text-transform: none;
  padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px;
}

/* banners: compact strips with a coloured edge instead of big blocks */
.banner {
  margin-top: 12px; padding: 9px 14px 9px 12px; gap: 10px; font-size: 13.5px; line-height: 1.45;
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 4%, transparent));
}
.banner + .banner { margin-top: 8px; }
.banner svg { width: 16px; height: 16px; }
.banner a { font-size: 13px; white-space: nowrap; }
.banner.warn-banner, .estop-banner {
  border-color: color-mix(in srgb, var(--red) 24%, transparent); border-left-color: var(--red);
  background: linear-gradient(90deg, color-mix(in srgb, var(--red) 13%, transparent), color-mix(in srgb, var(--red) 4%, transparent));
}
.banner.warn-banner svg, .estop-banner svg { color: var(--red); }
.banner.dry-banner { border-color: color-mix(in srgb, #3c8df0 28%, transparent); border-left-color: #3c8df0; background: linear-gradient(90deg, color-mix(in srgb, #3c8df0 14%, transparent), color-mix(in srgb, #3c8df0 4%, transparent)); }

/* page heads: tighter title, the tag sits on the baseline as a normal pill */
.page-head { margin-bottom: 20px; min-height: 40px; }
.page-head h1 { font-size: 28px; letter-spacing: -.025em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head h1 .tag { font-size: 11.5px; font-weight: 600; letter-spacing: .01em; text-transform: none; height: 22px; background: var(--raise); }
.page-head h1 .tag.pos { background: var(--green-soft); color: var(--green); }
.lead { line-height: 1.6; color: var(--muted); }
.lead b { color: var(--text); font-weight: 600; }

/* cards: one radius, a faint top highlight, calm hover */
.card, .acc-card:not(.add), .table-wrap { border-radius: 16px; }
[data-theme="dark"] .card, [data-theme="dark"] .table-wrap {
  box-shadow: inset 0 1px 0 rgba(255, 246, 230, .035), 0 1px 2px rgba(0, 0, 0, .18);
}
.card-head h2 { font-size: 15.5px; font-weight: 650; }

/* buttons: one height, a soft lift on hover */
.btn { min-height: 38px; font-weight: 550; }
.btn.sm { min-height: 32px; }
.btn:not(.primary):not(.danger):not(.ghost):hover:not(:disabled) { border-color: var(--line-2); }
.btn.primary { font-weight: 600; }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 20%, transparent); }

/* inputs: a soft focus ring */
input:focus, select:focus, textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none;
}

/* tables: the head stays visible while scrolling long lists */
.table thead th { position: sticky; top: 0; z-index: 1; backdrop-filter: blur(8px); }
.table td { transition: background .12s; }
.table .empty-row td { padding: 48px 16px; font-size: 14px; color: var(--muted); }

/* topbar: slightly shorter, controls line up */
.controls { gap: 10px; }
.controls .select select { min-height: 38px; border-radius: 10px; }

/* ---- «Защита торговли»: the emergency stop now lives at the bottom of the dashboard */
.safety-card {
  margin-top: 18px; display: flex; align-items: center; gap: 16px;
  border-style: dashed; border-color: color-mix(in srgb, var(--red) 22%, var(--line));
}
.safety-card:hover { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.safety-ico {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red);
}
.safety-ico svg { width: 20px; height: 20px; }
.safety-body { flex: 1; min-width: 0; }
.safety-body h2 { margin-bottom: 2px; }
.safety-body p { margin: 0; max-width: 720px; line-height: 1.5; }
.safety-card .estop-btn { flex: none; }
.safety-card.on { border-style: solid; border-color: color-mix(in srgb, var(--red) 50%, transparent); background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.safety-card.on .safety-ico { background: var(--red); color: #fff; }
.safety-card.dry { border-style: solid; border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.safety-card.dry .safety-ico { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); }
.estop-btn.on { animation: none; }

@media (max-width: 860px) {
  .page-head h1 { font-size: 24px; }
  .banner { padding: 8px 12px 8px 10px; }
  .safety-card { flex-wrap: wrap; gap: 12px; }
  .safety-card .estop-btn { width: 100%; justify-content: center; }
  .safety-card .estop-btn span { display: inline; }
}
