:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: #171717;
  color: #f2f2f2;
  --bg: #171717;
  --surface: #1f1f1f;
  --surface-hover: #292929;
  --line: #363636;
  --line-soft: #2d2d2d;
  --text: #f2f2f2;
  --text-secondary: #b7b7b7;
  --muted: #858585;
  --green: #42d392;
  --green-soft: rgba(66, 211, 146, .11);
  --red: #ef7d86;
  --red-soft: rgba(239, 125, 134, .1);
  --amber: #e2b96f;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { min-height: 100vh; margin: 0; background: var(--bg); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .36; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 60px;
  display: grid; grid-template-columns: auto minmax(430px, 1fr) auto; align-items: center; gap: 18px;
  padding: 0 28px; border-bottom: 1px solid var(--line-soft);
  background: rgba(23, 23, 23, .96); backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; text-decoration: none; }
.brand-name { font-size: 15px; font-weight: 650; letter-spacing: -.25px; }
.brand-mark { width: 24px; height: 24px; display: flex; align-items: flex-end; gap: 2px; padding: 5px 4px; border: 1px solid #3c3c3c; border-radius: 6px; background: #222; }
.brand-mark i { display: block; width: 4px; border-radius: 1px; background: var(--green); }
.brand-mark i:nth-child(1) { height: 6px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 12px; opacity: .78; }
.brand-mark i:nth-child(3) { height: 9px; }
.market-badge { justify-self: center; display: flex; align-items: center; gap: 7px; color: #d6d6d6; font-size: 11px; font-weight: 650; letter-spacing: .75px; }
.market-badge span:last-child { color: var(--muted); font-weight: 550; }
.market-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.connection { justify-self: end; display: flex; align-items: center; gap: 8px; color: var(--amber); font-size: 12px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(226, 185, 111, .1); }
.connection.live { color: var(--green); }
.connection.live .status-dot { box-shadow: 0 0 0 3px var(--green-soft); }
.topbar .view-switch { justify-self: center; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 18px; }

main { width: min(1520px, 100%); margin: 0 auto; padding: 34px 28px 24px; }
.workspace-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 25px; }
.title-block { min-width: 0; }
.section-label { display: block; margin-bottom: 9px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: 1.35px; }
h1 { margin: 0; font-size: clamp(25px, 2.3vw, 34px); font-weight: 620; letter-spacing: -1.05px; line-height: 1.1; }
.title-block p { max-width: 690px; margin: 10px 0 0; color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.view-switch { flex: 0 0 auto; display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #1c1c1c; }
.view-button { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; }
.view-button:hover { color: var(--text); background: var(--surface-hover); }
.view-button.active { color: var(--text); background: #303030; box-shadow: 0 0 0 1px #3a3a3a; }
.view-button span { min-width: 21px; padding: 1px 6px; border-radius: 999px; background: #3b3b3b; color: #d8d8d8; font-size: 10px; font-variant-numeric: tabular-nums; text-align: center; }
.view-button.active span { background: var(--green-soft); color: var(--green); }
.algorithm-view-switch { flex: 0 0 auto; display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #1c1c1c; }
.algorithm-view-switch button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; }
.algorithm-view-switch button:hover { color: var(--text); background: var(--surface-hover); }
.algorithm-view-switch button.active { color: var(--green); background: #303030; box-shadow: 0 0 0 1px #3a3a3a; }

.market-strip { min-height: 48px; display: flex; align-items: center; gap: 24px; padding: 8px 13px; border: 1px solid var(--line-soft); border-radius: 8px; background: #1c1c1c; color: var(--muted); font-size: 11px; }
.scanner-state { display: flex; align-items: center; gap: 9px; color: var(--text-secondary); font-weight: 550; white-space: nowrap; }
.scan-pulse { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.scan-pulse::after { content: ""; position: absolute; inset: -4px; border: 1px solid var(--green); border-radius: 50%; opacity: .22; }
.market-strip dl { display: flex; align-items: center; gap: 0; margin: 0; }
.market-strip dl > div { display: flex; align-items: baseline; gap: 6px; padding: 0 18px; border-left: 1px solid var(--line); }
.market-strip dt { color: var(--muted); }
.market-strip dd { margin: 0; color: #d2d2d2; font-variant-numeric: tabular-nums; }
.notice { margin-top: 14px; padding: 11px 13px; border: 1px solid #5a4930; border-radius: 7px; background: #282117; color: #edc985; font-size: 12px; line-height: 1.55; white-space: pre-line; }

.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin: 30px 0 15px; }
.results-title { display: flex; align-items: baseline; gap: 10px; }
h2 { margin: 0; font-size: 17px; font-weight: 620; letter-spacing: -.25px; }
#count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; gap: 10px; }
.search-control { position: relative; display: flex; align-items: center; }
.search-control input { width: 190px; height: 34px; padding: 0 30px 0 32px; border: 1px solid var(--line); border-radius: 7px; background: #1d1d1d; color: var(--text); font-size: 12px; }
.search-control input::placeholder { color: #777; }
.search-control input:hover, .size-control select:hover { border-color: #494949; }
.search-control input:focus { border-color: #4e7c67; background: #202020; }
.search-icon { position: absolute; left: 11px; width: 11px; height: 11px; border: 1.5px solid #888; border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; right: -4px; bottom: -2px; background: #888; transform: rotate(45deg); border-radius: 1px; }
.size-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.size-control select { height: 34px; padding: 0 26px 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #1d1d1d; color: #d6d6d6; font-size: 12px; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); box-shadow: 0 1px 0 rgba(255, 255, 255, .02); }
.card:hover { border-color: #3d3d3d; }
.card-head { min-height: 63px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px 9px; }
.instrument { min-width: 0; }
.symbol { margin: 0; overflow: hidden; color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: .15px; text-overflow: ellipsis; white-space: nowrap; }
.contract { display: block; margin-top: 4px; color: #6f6f6f; font-size: 10px; letter-spacing: .25px; text-transform: uppercase; }
.signal-rank { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 5px; padding: 5px 8px; border: 1px solid rgba(66, 211, 146, .2); border-radius: 6px; background: var(--green-soft); color: var(--green); }
.signal-rank strong { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.signal-rank span { color: #8cb8a2; font-size: 9px; text-transform: uppercase; letter-spacing: .45px; }
.signal-rank.sell { border-color: rgba(239, 125, 134, .2); background: var(--red-soft); color: var(--red); }
.signal-rank.sell span { color: #b89195; }
.signal-rank.observe { border-color: #414141; background: #292929; color: #c1c1c1; }
.signal-rank.observe span { color: #858585; }
.signal-rank.confirmed { border-color: rgba(66, 211, 146, .38); background: rgba(66, 211, 146, .16); color: #66e7ab; }
.quote-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 0 16px 12px; }
.quote { min-width: 0; display: flex; align-items: baseline; gap: 9px; }
.price { overflow: hidden; color: #e9e9e9; font-size: 23px; font-weight: 560; font-variant-numeric: tabular-nums; letter-spacing: -.55px; text-overflow: ellipsis; }
.change { font-size: 12px; font-variant-numeric: tabular-nums; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.market-state { display: flex; align-items: center; gap: 6px; color: #777; font-size: 10px; white-space: nowrap; }
.market-state i { width: 5px; height: 5px; border-radius: 50%; background: #666; }
.market-state.live i { background: var(--green); }
.market-state.warning { color: var(--amber); }
.market-state.warning i { background: var(--amber); }

.chart-wrap { position: relative; height: 258px; margin: 0 5px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: #1d1d1d; }
.chart { width: 100%; height: 100%; }
.chart-wrap.is-panning, .chart-wrap.is-panning * { cursor: grabbing !important; user-select: none; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.chart-meta { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px 10px; color: #737373; font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-history { flex: 0 0 auto; }

.signal { margin: 0 12px 11px; padding: 12px; border: 1px solid rgba(66, 211, 146, .18); border-radius: 8px; background: #1c2420; }
.signal.sell { border-color: rgba(239, 125, 134, .18); background: #261e20; }
.signal.observe { border-color: #383838; background: #222; }
.signal.confirmed { border-color: rgba(66, 211, 146, .38); box-shadow: inset 2px 0 0 var(--green); }
.signal.inactive { opacity: .82; }
.signal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.signal-head > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.signal-side { flex: 0 0 auto; padding: 3px 5px; border-radius: 4px; background: rgba(66, 211, 146, .14); color: var(--green); font-size: 9px; font-weight: 750; letter-spacing: .65px; }
.signal-side.sell { background: rgba(239, 125, 134, .14); color: var(--red); }
.signal-side.mixed { background: #323232; color: #bdbdbd; }
.signal-title { overflow: hidden; color: #d9e8e0; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.signal.sell .signal-title { color: #ead8da; }
.signal-window { color: #829187; font-size: 10px; white-space: nowrap; }
.signal.sell .signal-window { color: #998489; }
.signal-primary { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10px; }
.signal-primary > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.signal-primary span { color: #7e8b84; font-size: 9px; text-transform: uppercase; letter-spacing: .45px; }
.signal-primary strong { overflow: hidden; color: #e1e6e3; font-size: 12px; font-weight: 520; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.signal-path { display: flex; align-items: center; gap: 8px; margin-top: 11px; }
.signal-path > span { flex: 0 0 auto; color: #718078; font-size: 9px; letter-spacing: .45px; text-transform: uppercase; }
.signal-path-items { min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.signal-path-items span { flex: 0 0 auto; padding: 3px 6px; border: 1px solid rgba(66, 211, 146, .2); border-radius: 999px; color: #9ec0ae; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.signal-path-items span.upper { border-color: rgba(239, 125, 134, .22); color: #c09ca0; }
.signal-path-items span + span::before { content: "→"; margin-right: 7px; color: #686868; }
.signal-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 11px; }
.signal-tags span { padding: 4px 6px; border: 1px solid #334139; border-radius: 5px; color: #a2afa8; font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.signal.sell .signal-tags span { border-color: #453438; color: #b1a0a3; }

.book-insight { margin: 0 12px 11px; padding: 11px 12px; border: 1px solid #343b37; border-radius: 8px; background: #202321; }
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.book-head > div { display: flex; align-items: center; gap: 7px; }
.book-head strong { color: #d2d8d5; font-size: 10px; font-weight: 620; letter-spacing: .15px; }
.book-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.book-evidence { overflow: hidden; color: #8ca597; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.book-levels { display: grid; gap: 1px; }
.book-row { min-height: 24px; display: grid; grid-template-columns: 48px 1fr 1fr 1fr; align-items: center; column-gap: 8px; padding: 0 7px; border-radius: 4px; background: #242725; color: #b8bfbb; font-size: 9px; font-variant-numeric: tabular-nums; }
.book-row strong { font-size: 9px; font-weight: 650; text-transform: uppercase; }
.book-row.bid strong { color: var(--green); }
.book-row.ask strong { color: var(--red); }
.book-labels { min-height: 17px; background: transparent; color: #6f7773; font-size: 8px; text-transform: uppercase; letter-spacing: .35px; }
.book-flow { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; color: #747c78; font-size: 9px; }
.book-flow strong { margin-left: 3px; color: #c0c7c3; font-weight: 560; font-variant-numeric: tabular-nums; }
.book-flow strong.positive { color: var(--green); }
.book-flow strong.negative { color: var(--red); }

.card-stats { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 8px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.card-stats > div { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.card-stats dt { overflow: hidden; color: #777; font-size: 9px; letter-spacing: .25px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.card-stats dd { overflow: hidden; margin: 0; color: #d1d1d1; font-size: 12px; font-weight: 520; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; justify-content: space-between; gap: 10px; padding: 0 16px 13px; color: #696969; font-size: 9px; line-height: 1.4; }
.quality { color: #7b7b7b; }
.card.offline { border-color: #5a4930; }
.card.offline .chart { opacity: .55; }

.empty { min-height: 330px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border: 1px dashed #343434; border-radius: 10px; background: #1a1a1a; color: var(--muted); text-align: center; }
.empty strong { color: #cfcfcf; font-size: 14px; font-weight: 560; }
.empty > span:last-child { max-width: 440px; padding: 0 20px; font-size: 12px; line-height: 1.55; }
.empty-radar { position: relative; width: 42px; height: 42px; margin-bottom: 6px; border: 1px solid #3b3b3b; border-radius: 50%; }
.empty-radar::before, .empty-radar::after { content: ""; position: absolute; background: #353535; }
.empty-radar::before { width: 1px; height: 100%; left: 50%; }
.empty-radar::after { width: 100%; height: 1px; top: 50%; }
.empty-radar i { position: absolute; z-index: 1; width: 6px; height: 6px; right: 8px; top: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 22px 0; color: var(--muted); font-size: 11px; }
.pagination button { min-width: 82px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #1f1f1f; color: #c7c7c7; font-size: 11px; }
.pagination button:hover:enabled { border-color: #4a4a4a; background: #282828; color: #fff; }
#page-label { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
footer:not(.card-foot) { display: flex; justify-content: space-between; gap: 16px; padding-top: 15px; border-top: 1px solid var(--line-soft); color: #656565; font-size: 9px; line-height: 1.6; }
footer:not(.card-foot) a { color: #858585; text-underline-offset: 2px; }
footer:not(.card-foot) a:hover { color: #c5c5c5; }

.history-toolbar {
  display: grid; grid-template-columns: 1.15fr 1.2fr 1fr .85fr minmax(180px, 1fr); gap: 10px;
  padding: 14px; border: 1px solid var(--line-soft); border-radius: 10px; background: #1c1c1c;
}
.history-toolbar label { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; }
.history-toolbar select, .history-toolbar input {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 7px; background: #222; color: var(--text); font-size: 14px;
}
.history-toolbar select { padding: 0 30px 0 10px; }
.history-toolbar .history-search { align-self: end; }
.history-toolbar .history-search input { padding-left: 34px; }
.history-toolbar select:hover, .history-toolbar input:hover { border-color: #4a4a4a; }
.history-toolbar select:focus, .history-toolbar input:focus { border-color: #4e7c67; background: #242424; }

.history-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px;
  overflow: hidden; border: 1px solid var(--line-soft); border-radius: 10px; background: #1c1c1c;
}
.history-strip > div { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 13px 15px; border-left: 1px solid var(--line-soft); }
.history-strip > div:first-child { border-left: 0; }
.history-strip span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-strip strong { color: #ddd; font-size: 18px; font-weight: 590; font-variant-numeric: tabular-nums; }
.history-strip .similar strong { color: var(--green); }
.history-strip .rejected strong { color: var(--red); }

.history-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 28px 0 14px; }
.history-results-head > div { display: flex; align-items: baseline; gap: 10px; }
.history-results-head > div span { color: var(--muted); font-size: 13px; }
.history-results-head p { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: right; }
.history-cards { display: grid; gap: 16px; }
.history-card { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--surface); }
.history-card:hover { border-color: #3e3e3e; }
.history-card-head { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 17px; border-bottom: 1px solid var(--line-soft); }
.history-card-head > div:first-child { min-width: 0; }
.history-symbol-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.history-symbol { margin: 0; color: var(--text); font-size: 17px; font-weight: 650; letter-spacing: .1px; }
.history-tier-badge, .history-verdict-badge { padding: 4px 7px; border: 1px solid #3c3c3c; border-radius: 5px; color: #aaa; font-size: 11px; }
.history-tier-badge { border-color: rgba(66, 211, 146, .25); background: var(--green-soft); color: var(--green); }
.history-verdict-badge.similar { border-color: rgba(66, 211, 146, .3); color: var(--green); }
.history-verdict-badge.not_similar { border-color: rgba(239, 125, 134, .3); color: var(--red); }
.history-verdict-badge.unclear { border-color: rgba(226, 185, 111, .3); color: var(--amber); }
.history-window { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.history-score { flex: 0 0 auto; display: flex; align-items: baseline; gap: 5px; padding: 7px 10px; border: 1px solid rgba(66, 211, 146, .25); border-radius: 7px; background: var(--green-soft); color: var(--green); }
.history-score strong { font-size: 18px; font-weight: 650; }
.history-score span { font-size: 11px; }
.history-card-body { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .75fr); }
.history-chart-column { min-width: 0; border-right: 1px solid var(--line-soft); }
.history-chart-wrap { position: relative; height: 360px; background: #1d1d1d; }
.history-chart { width: 100%; height: 100%; }
.history-chart-legend { position: absolute; z-index: 3; top: 9px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 6px 8px; border: 1px solid #333; border-radius: 6px; background: rgba(29, 29, 29, .88); color: #9b9b9b; font-size: 11px; pointer-events: none; }
.history-chart-legend .buy { color: var(--green); }
.history-chart-legend .sell { color: var(--red); }
.history-chart-legend .mixed { color: #d0d0d0; }
.history-chart-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #1d1d1d; color: var(--muted); font-size: 14px; }
.history-chart-loading.error { color: var(--red); }
.history-chart-meta { min-height: 39px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.history-chart-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-detail { min-width: 0; padding: 16px; }
.episode-control { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.episode-control select { width: 100%; height: 38px; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #222; color: var(--text); font-size: 14px; }
.history-callout { margin-top: 14px; padding: 12px 13px; border: 1px solid rgba(66, 211, 146, .28); border-radius: 8px; background: #1c2721; }
.history-callout > span { display: block; color: #84a794; font-size: 11px; font-weight: 650; letter-spacing: .55px; text-transform: uppercase; }
.history-callout strong { display: block; margin-top: 6px; color: #dff4e8; font-size: 16px; font-weight: 650; line-height: 1.35; }
.history-callout p { margin: 6px 0 0; color: #aac0b4; font-size: 13px; line-height: 1.5; }
.history-callout.medium { border-color: rgba(226, 185, 111, .3); background: #282319; }
.history-callout.medium > span, .history-callout.medium strong { color: var(--amber); }
.history-callout.medium p { color: #c0b292; }
.history-phase-title { margin: 16px 0 12px; color: #d9e8e0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.history-metrics { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.history-metrics > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 10px; border-top: 1px solid var(--line-soft); border-left: 1px solid var(--line-soft); }
.history-metrics > div:nth-child(-n+2) { border-top: 0; }
.history-metrics > div:nth-child(odd) { border-left: 0; }
.history-metrics dt { color: var(--muted); font-size: 12px; }
.history-metrics dd { overflow: hidden; margin: 0; color: #ddd; font-size: 14px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.history-phase-path { margin-top: 15px; }
.history-phase-path > span { color: var(--muted); font-size: 12px; }
.history-phase-path > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.history-phase-path i { padding: 5px 7px; border: 1px solid rgba(66, 211, 146, .22); border-radius: 999px; color: #9dc3af; font-size: 12px; font-style: normal; }
.history-phase-path i.upper { border-color: rgba(239, 125, 134, .25); color: #cda4a8; }
.history-reasons { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.history-reasons > strong { color: #cfcfcf; font-size: 13px; font-weight: 600; }
.history-reasons ul { display: grid; gap: 7px; margin: 9px 0 0; padding: 0; list-style: none; }
.history-reasons li { position: relative; padding-left: 17px; color: #aaa; font-size: 12px; line-height: 1.4; }
.history-reasons li::before { content: ""; position: absolute; left: 1px; top: .48em; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.history-review-hint { margin: 15px 0 0; padding: 10px 11px; border-radius: 7px; background: #242424; color: #999; font-size: 12px; line-height: 1.5; }
.history-review-hint strong { color: #cfcfcf; font-weight: 600; }
.history-review { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 18px; }
.history-review button { min-height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #242424; color: #bbb; font-size: 13px; }
.history-review button:hover { border-color: #505050; background: #2b2b2b; color: #fff; }
.history-review button[data-verdict="similar"].active { border-color: rgba(66, 211, 146, .5); background: var(--green-soft); color: var(--green); }
.history-review button[data-verdict="not_similar"].active { border-color: rgba(239, 125, 134, .5); background: var(--red-soft); color: var(--red); }
.history-review button[data-verdict="unclear"].active { border-color: rgba(226, 185, 111, .5); background: rgba(226, 185, 111, .1); color: var(--amber); }
.history-review button.saving { opacity: .55; }

.overview-actions { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 7px; border: 1px solid var(--line-soft); border-radius: 9px; background: #1c1c1c; }
.overview-filter-button { min-height: 32px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 7px; background: #252525; color: #d0d0d0; font-size: 11px; }
.overview-filter-button:hover, .overview-filter-button.active { border-color: rgba(66, 211, 146, .4); color: #e6fff2; }
.overview-filter-button b { min-width: 18px; padding: 2px 5px; border-radius: 999px; background: var(--green); color: #10251b; font-size: 9px; text-align: center; }
.filter-icon { position: relative; width: 13px; height: 10px; border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.filter-icon::before { content: ""; position: absolute; top: 3px; left: 3px; width: 7px; border-top: 1.5px solid currentColor; }
.overview-grid-control, .overview-timeframe-control, .overview-sort-control, .overview-preset-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.overview-grid-control { margin-left: auto; }
.overview-grid-control select, .overview-timeframe-control select, .overview-sort-control select, .overview-preset-control select { height: 32px; padding: 0 28px 0 9px; border: 1px solid var(--line); border-radius: 7px; background: #252525; color: #ddd; font-size: 11px; }
.overview-sort-control select { min-width: 132px; }
.overview-preset-control select { min-width: 128px; max-width: 180px; }
.overview-search input { width: 100%; height: 35px; }
.exchange-filter { min-width: 0; display: flex; align-items: center; gap: 6px; height: 35px; margin: 0; padding: 0; border: 0; }
.exchange-filter legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.exchange-filter label { flex: 1; min-width: 0; }
.exchange-filter input { position: absolute; opacity: 0; pointer-events: none; }
.exchange-filter span { height: 35px; display: grid; place-items: center; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #222; color: #888; font-size: 11px; transition: .15s ease; }
.exchange-filter input:checked + span { border-color: rgba(66, 211, 146, .32); background: var(--green-soft); color: #bce6d0; }
.exchange-filter input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.overview-toggle { min-height: 35px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.overview-toggle input { accent-color: var(--green); }
.overview-toggle span { color: #bbb; font-size: 12px; }
.overview-metric-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 9px 0 0; padding: 0; border: 0; }
.overview-metric-filter legend { float: left; margin-right: 4px; color: var(--muted); font-size: 10px; line-height: 27px; text-transform: uppercase; letter-spacing: .55px; }
.overview-metric-filter label { position: relative; }
.overview-metric-filter input { position: absolute; opacity: 0; pointer-events: none; }
.overview-metric-filter span { min-height: 27px; display: inline-flex; align-items: center; padding: 0 9px; border: 1px solid var(--line-soft); border-radius: 999px; background: #1c1c1c; color: #777; font-size: 10px; cursor: pointer; transition: .15s ease; }
.overview-metric-filter input:checked + span { border-color: rgba(66, 211, 146, .28); background: var(--green-soft); color: #a8d5bd; }
.overview-metric-filter input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.overview-card-mode { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line-soft); border-radius: 7px; background: #1c1c1c; }
.overview-card-mode > span { padding: 0 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.overview-card-mode button { min-height: 27px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: #777; font-size: 10px; }
.overview-card-mode button:hover { color: #ccc; background: #282828; }
.overview-card-mode button.active { background: #303030; color: var(--green); box-shadow: 0 0 0 1px #3c3c3c; }
.overview-simple .overview-metric-filter { display: none; }
.overview-results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 27px 0 13px; }
.overview-results-head > div { display: flex; align-items: baseline; gap: 10px; }
.overview-results-head span, .overview-results-head p { color: var(--muted); font-size: 12px; }
.overview-results-head p { max-width: 650px; margin: 0; text-align: right; line-height: 1.45; }
.overview-cards { display: grid; grid-template-columns: repeat(var(--overview-columns, 4), minmax(0, 1fr)); gap: 11px; margin-top: 13px; }
.overview-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface); transition: border-color .15s ease, transform .15s ease; }
.overview-copy-open { position: absolute; z-index: 4; top: 8px; left: 8px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid #4b4b4b; border-radius: 5px; background: rgba(30,30,30,.9); color: #bdbdbd; opacity: 0; pointer-events: none; transition: opacity .12s ease, border-color .12s ease; }
.overview-copy-open svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.overview-card:hover .overview-copy-open, .overview-card:focus-within .overview-copy-open, .overview-copy-open:focus-visible { opacity: 1; pointer-events: auto; }
.overview-copy-open:hover, .overview-copy-open:focus-visible, .overview-copy-open.copy-success { border-color: var(--green); color: var(--green); }
@media (hover: none) { .overview-copy-open { opacity: 1; pointer-events: auto; } }
.overview-card:hover { border-color: #424242; transform: translateY(-1px); }
.overview-card.overview-frozen { border-color: var(--green); }
.overview-card > header { min-height: 57px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px 7px 42px; }
.overview-card h3 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: .12px; }
.overview-card > header > div:first-child > span { display: block; margin-top: 4px; color: #727272; font-size: 9px; letter-spacing: .55px; text-transform: uppercase; }
.overview-venues { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
.overview-venue { padding: 3px 5px; border: 1px solid #3a3a3a; border-radius: 4px; color: #888; font-size: 9px; font-weight: 650; letter-spacing: .25px; text-transform: uppercase; }
.overview-venue.primary { border-color: rgba(66, 211, 146, .32); background: var(--green-soft); color: var(--green); }
.overview-change { color: var(--green); }
.overview-change.negative { color: var(--red); }
.overview-mini-chart { position: relative; width: 100%; height: 154px; overflow: hidden; background: #1d1d1d; border-top: 1px solid #242424; cursor: crosshair; touch-action: none; }
.overview-hover-label { position: absolute; z-index: 6; bottom: 1px; left: 0; display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border: 1px solid #3f4448; border-radius: 3px; background: #282d31; color: #e8e8e8; font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 6px #0008; }
.overview-hover-value { margin-left: 6px; padding-left: 6px; border-left: 1px solid #5a6063; color: #b9e8cf; }
.overview-ruler { position: absolute; z-index: 7; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.overview-ruler[hidden], .overview-ruler-label[hidden] { display: none; }
.overview-ruler-line { stroke: #d8b977; stroke-width: 1.5; stroke-dasharray: 5 3; }
.overview-ruler-start, .overview-ruler-end { fill: #e9cf91; stroke: #242424; stroke-width: 1.5; }
.overview-ruler-label { position: absolute; z-index: 8; max-width: calc(100% - 12px); padding: 4px 7px; border: 1px solid #7b6c4d; border-radius: 4px; background: #292821ed; color: #f5e7ca; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; box-shadow: 0 2px 8px #0009; }
.overview-ruler-label.negative { color: #f3a6ac; border-color: #875a60; }
.overview-current-volume { position: absolute; z-index: 5; right: 0; bottom: 31px; min-width: 55px; padding: 2px 3px; background: #385248; color: #e0f5e7; font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 14px; text-align: right; pointer-events: none; }
.overview-current-volume.negative { background: #654248; color: #ffe1e3; }
.overview-current-volume[hidden] { display: none; }
.overview-mini-chart[data-loading="true"]::after, .overview-mini-chart[data-unavailable="true"]::after { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; background: #1d1d1d; color: #777; font-size: 11px; }
.overview-mini-chart[data-loading="true"]::after { content: "Загружаем свечи…"; }
.overview-mini-chart[data-unavailable="true"]::after { content: "Свечи временно недоступны"; }
.overview-inline-metrics { min-height: 38px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; padding: 8px 11px; border-top: 1px solid var(--line-soft); }
.overview-inline-metrics > span { min-width: 0; display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.overview-inline-metrics i { color: #727272; font-size: 9px; font-style: normal; text-transform: uppercase; letter-spacing: .25px; }
.overview-inline-metrics strong { overflow: hidden; color: #cfcfcf; font-size: 11px; font-weight: 550; font-variant-numeric: tabular-nums; text-overflow: ellipsis; }
.overview-inline-metrics .overview-change { color: var(--green); }
.overview-inline-metrics .overview-change.negative { color: var(--red); }
.overview-card > footer { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; border-top: 1px solid var(--line-soft); }
.overview-primary { color: #777; font-size: 10px; text-transform: uppercase; }
.overview-compare { min-height: 29px; padding: 0 9px; border: 1px solid #414141; border-radius: 6px; background: #272727; color: #c8c8c8; font-size: 11px; }
.overview-compare:hover { border-color: #557364; color: #e4fff0; }
.overview-simple .overview-cards {
  grid-template-columns: repeat(var(--overview-columns, 4), minmax(0, 1fr));
  gap: 0; margin-top: 0;
}
.overview-simple .overview-card {
  position: relative; height: var(--overview-card-height, 220px);
  border: 0; border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft); border-radius: 0; background: #1d1d1d;
}
.overview-simple .overview-cards[data-count="3"][data-columns="2"][data-rendered-count="3"] > .overview-card.overview-featured {
  grid-row: span 2; height: calc(var(--overview-card-height, 220px) * 2);
}
.overview-simple .overview-card:hover { transform: none; border-color: var(--line); }
.overview-simple .overview-card.overview-frozen { outline: 1px solid rgba(66, 211, 146, .85); outline-offset: -1px; }
.overview-simple .overview-card > header {
  position: absolute; top: 10px; right: 55px; left: 0; z-index: 2;
  min-height: 0; display: block; padding: 0 8px;
  text-align: center; pointer-events: none;
}
.overview-simple[data-ticker-position^="middle-"] .overview-card > header { top: 50%; transform: translateY(-50%); }
.overview-simple[data-ticker-position^="bottom-"] .overview-card > header { top: auto; bottom: 27px; }
.overview-simple[data-ticker-position$="-left"] .overview-card > header { text-align: left; }
.overview-simple[data-ticker-position$="-right"] .overview-card > header { text-align: right; }
.overview-simple[data-ticker-position="top-left"] .overview-card > header { left: 35px; }
.overview-simple .overview-mini-chart {
  height: 100%; border-top: 0;
}
.overview-simple .overview-card > header > div:first-child > span,
.overview-simple .overview-venues,
.overview-simple .overview-inline-metrics,
.overview-simple .overview-card > footer { display: none; }
.overview-simple .overview-card h3 {
  overflow: hidden; color: rgb(222 222 222 / var(--overview-ticker-opacity, .46));
  font-size: var(--overview-ticker-size, 28px); font-weight: 560;
  line-height: 1.1; letter-spacing: .02em; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .7);
}
.overview-view-dialog { position: fixed; inset: 0 auto auto 0; z-index: 30; width: min(260px, calc(100vw - 20px)); margin: 0; padding: 0; border: 1px solid #454545; border-radius: 9px; background: #202020; color: #eee; box-shadow: 0 16px 42px #000a; }
.overview-view-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #363636; font-size: 12px; }
.overview-view-head button { width: 22px; height: 22px; padding: 0; border: 0; background: none; color: #aaa; font-size: 19px; }
.overview-view-fields { display: grid; gap: 13px; padding: 12px; }
.overview-view-field { display: grid; gap: 6px; color: #aaa; font-size: 10px; text-transform: none; letter-spacing: 0; }
.overview-view-field select { width: 100%; min-width: 0; }
.overview-view-field select { height: 32px; padding: 0 8px; border: 1px solid #414141; border-radius: 5px; background: #282828; color: #e2e2e2; }
.overview-view-field input[type="range"] { width: 100%; margin: 2px 0; accent-color: var(--green); }
.overview-view-field > span:has(output) { display: flex; justify-content: space-between; }
.overview-view-field output { color: #d6d6d6; font-variant-numeric: tabular-nums; }
.overview-view-section { padding-top: 10px; border-top: 1px solid #363636; color: #ddd; font-size: 11px; font-weight: 650; }
.overview-view-hint { margin: 0; color: #858585; font-size: 10px; line-height: 1.4; }
.overview-view-field .overview-card-mode { width: fit-content; }
.overview-view-field.overview-grid-control { margin-left: 0; }
.overview-filter-dialog { width: min(1060px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid #414141; border-radius: 11px; background: #1b1b1b; color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.58); }
.overview-filter-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.overview-audit-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid #414141; border-radius: 11px; background: #1b1b1b; color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.58); }
.overview-audit-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.overview-audit-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(150px, .7fr) auto; gap: 9px; align-items: end; padding: 15px 16px 8px; }
.overview-audit-form label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .45px; }
.overview-audit-form input, .overview-audit-form select, .overview-audit-form button { height: 37px; border: 1px solid var(--line); border-radius: 7px; background: #242424; color: #ddd; }
.overview-audit-form input, .overview-audit-form select { padding: 0 10px; }
.overview-audit-form button { padding: 0 14px; border-color: #3f765b; background: var(--green); color: #10251b; font-weight: 650; }
.overview-audit-explain { margin: 3px 16px 12px; color: #858585; font-size: 11px; line-height: 1.5; }
.overview-audit-state { margin: 12px 16px 16px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 8px; color: #aaa; font-size: 12px; }
.overview-audit-dialog .notice { margin: 12px 16px 16px; }
.overview-audit-result { padding: 3px 16px 16px; }
.audit-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px 12px; margin-bottom: 9px; }
.audit-summary strong { color: #f0f0f0; font-size: 17px; }
.audit-summary span { color: #858585; font-size: 11px; }
.audit-table { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; }
.audit-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.1fr; min-height: 42px; align-items: center; border-top: 1px solid var(--line-soft); }
.audit-row:first-child { border-top: 0; }
.audit-row > * { min-width: 0; padding: 8px 10px; font-size: 11px; font-variant-numeric: tabular-nums; }
.audit-row > * + * { border-left: 1px solid var(--line-soft); }
.audit-row strong { color: #d2d2d2; font-weight: 600; }
.audit-head { min-height: 32px; background: #222; color: #777; text-transform: uppercase; letter-spacing: .4px; }
.audit-status-pass { color: var(--green); }
.audit-status-fail { color: var(--red); }
.audit-status-wait { color: #c4a56a; }
.audit-closed-check { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; padding: 10px; border: 1px solid rgba(66, 211, 146, .2); border-radius: 8px; background: rgba(66, 211, 146, .045); }
.audit-closed-check > span { color: #999; font-size: 10px; }
.audit-closed-check > span:first-child { color: var(--green); font-weight: 700; text-transform: uppercase; letter-spacing: .45px; }
.audit-closed-check strong, .audit-closed-check b { color: #d2d2d2; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.audit-closed-check .audit-status-pass { color: var(--green); }
.audit-closed-check .audit-status-fail { color: var(--red); }
.overview-audit-note { margin: 10px 1px 0; color: #888; font-size: 11px; line-height: 1.45; }
.filter-dialog-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 17px; border-bottom: 1px solid var(--line-soft); background: rgba(27,27,27,.98); }
.filter-dialog-head span { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.filter-dialog-head h2 { margin-top: 3px; font-size: 20px; }
.filter-dialog-head button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #242424; color: #aaa; font-size: 23px; line-height: 1; }
.filter-templates { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(160px, .9fr) minmax(170px, 1fr) auto auto; align-items: center; gap: 8px; margin: 14px 16px 0; padding: 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #1e1e1e; }
.filter-templates > div { display: flex; flex-direction: column; gap: 3px; }
.filter-templates > div span { color: var(--green); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; }
.filter-templates > div strong { color: #d8d8d8; font-size: 11px; font-weight: 550; }
.filter-templates select, .filter-templates input, .filter-common select, .filter-rule select, .filter-rule input { min-width: 0; height: 35px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #222; color: #ddd; font-size: 12px; }
.filter-templates button { height: 35px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: #272727; color: #c8c8c8; font-size: 11px; }
.filter-templates button:hover { border-color: #557364; color: #e4fff0; }
.filter-templates small { grid-column: 2 / -1; min-height: 14px; color: #9ac8ad; font-size: 10px; }
.filter-common { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 9px; margin: 10px 16px 0; padding: 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: #1e1e1e; }
.filter-common .exchange-filter { grid-column: 1 / -1; }
.filter-common > label:not(.search-control):not(.overview-toggle) { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 10px; }
.filter-common .overview-toggle { align-items: center; align-self: end; }
.filter-rule-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 10px 16px 16px; }
.filter-rule { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 9px; background: #1e1e1e; }
.filter-rule h3 { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: #ddd; font-size: 14px; font-weight: 620; }
.filter-rule label { display: grid; grid-template-columns: minmax(92px, .8fr) minmax(0, 1.1fr); gap: 7px; margin: 7px; }
.filter-rule label > span { min-height: 35px; display: flex; align-items: center; padding: 0 10px; border-radius: 6px; background: #252525; color: #bbb; font-size: 11px; }
.filter-rule select, .filter-rule input { width: 100%; }
.filter-rule select:disabled { opacity: 1; color: #aaa; cursor: default; }
.filter-dialog-actions { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--line-soft); background: rgba(27,27,27,.98); }
.filter-dialog-actions button { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 7px; background: #262626; color: #bbb; font-size: 12px; }
.filter-dialog-actions button.primary { margin-left: auto; border-color: #3f765b; background: var(--green); color: #10251b; font-weight: 650; }
#overview-filter-validation { color: var(--red); font-size: 11px; }
.overview-dialog { width: min(1180px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid #414141; border-radius: 11px; background: #1b1b1b; color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.overview-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.overview-dialog-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 17px; border-bottom: 1px solid var(--line-soft); background: rgba(27,27,27,.97); }
.overview-dialog-head span { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.overview-dialog-head h2 { margin-top: 3px; font-size: 20px; }
.overview-dialog-head button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: #242424; color: #aaa; font-size: 23px; line-height: 1; }
.overview-dialog-summary { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 16px 0; }
.overview-dialog-summary span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; color: #aaa; font-size: 11px; }
.overview-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px 16px; }
.comparison-panel { min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; background: #1e1e1e; }
.comparison-panel header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.comparison-panel header strong { font-size: 12px; text-transform: uppercase; }
.comparison-panel header span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.comparison-chart { height: 250px; }
.comparison-empty { height: 250px; display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: 12px; text-align: center; }
.overview-dialog-note { margin: 0; padding: 0 16px 15px; color: #777; font-size: 11px; }

@media (min-width: 1660px) {
  main { width: min(1800px, 100%); }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1250px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 18px; }
  .topbar-right .market-badge { display: none; }
  .filter-rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .topbar { grid-template-columns: auto auto; padding: 8px 16px; }
  .topbar .view-switch { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .topbar-right { justify-self: end; }
  .workspace-head { align-items: flex-start; flex-direction: column; gap: 20px; }
  .market-strip { flex-wrap: wrap; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .history-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-toolbar .history-search { grid-column: 1 / -1; }
  .history-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-strip > div:nth-child(4) { border-left: 0; }
  .history-strip > div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .history-results-head { align-items: flex-start; flex-direction: column; }
  .history-results-head p { text-align: left; }
  .history-card-body { grid-template-columns: 1fr; }
  .history-chart-column { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .overview-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-templates > div, .filter-templates small { grid-column: 1 / -1; }
  .filter-common { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-common .overview-toggle { align-self: center; }
  .overview-results-head { align-items: flex-start; flex-direction: column; }
  .overview-results-head p { text-align: left; }
}
@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 56px; padding: 8px 16px; }
  .market-badge { display: none; }
  .connection-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  main { padding: 25px 12px 18px; }
  .workspace-head { margin-bottom: 19px; }
  .title-block p { font-size: 13px; }
  .view-switch { width: 100%; }
  .view-button { flex: 1; justify-content: center; }
  .workspace-head { align-items: stretch; flex-direction: column; gap: 14px; }
  .algorithm-view-switch { width: 100%; }
  .algorithm-view-switch button { flex: 1; }
  .market-strip { gap: 11px; padding: 10px 12px; }
  .scanner-state { width: 100%; }
  .market-strip dl { width: 100%; justify-content: space-between; }
  .market-strip dl > div { flex: 1; align-items: flex-start; flex-direction: column; gap: 2px; padding: 0 10px; }
  .market-strip dl > div:first-child { padding-left: 0; border-left: 0; }
  .results-head { align-items: flex-start; flex-direction: column; margin-top: 23px; }
  .controls { width: 100%; }
  .search-control { flex: 1; }
  .search-control input { width: 100%; }
  .size-control > span { display: none; }
  .chart-wrap { height: 235px; }
  .signal-primary { grid-template-columns: 1fr; }
  .card-stats { grid-template-columns: 1.2fr 1fr 1fr; }
  .history-toolbar { grid-template-columns: 1fr; }
  .history-toolbar .history-search { grid-column: auto; }
  .history-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-strip > div, .history-strip > div:nth-child(4) { border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); }
  .history-strip > div:nth-child(odd) { border-left: 0; }
  .history-strip > div:nth-child(-n+2) { border-top: 0; }
  .history-chart-wrap { height: 285px; }
  .history-chart-meta { align-items: flex-start; flex-direction: column; }
  .history-card-head { align-items: flex-start; }
  .history-detail { padding: 13px; }
  .history-review { grid-template-columns: 1fr; }
  .overview-actions { align-items: stretch; flex-wrap: wrap; }
  .overview-grid-control, .overview-timeframe-control, .overview-sort-control, .overview-preset-control { flex: 1 1 45%; margin-left: 0; }
  .overview-grid-control select, .overview-timeframe-control select, .overview-sort-control select, .overview-preset-control select { flex: 1; max-width: none; }
  .exchange-filter { flex-wrap: wrap; height: auto; }
  .exchange-filter label { flex: 1 1 42%; }
  .overview-cards { grid-template-columns: 1fr; }
  .filter-templates, .filter-common, .filter-rule-grid { grid-template-columns: 1fr; }
  .filter-rule-grid { padding: 9px 10px 12px; }
  .filter-templates, .filter-common { margin-left: 10px; margin-right: 10px; }
  .overview-comparison { grid-template-columns: 1fr; padding: 10px; }
  .overview-audit-form { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: .9fr 1fr 1fr; }
  .audit-row > *:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line-soft); border-left: 0; }
  footer:not(.card-foot) { flex-direction: column; }
}
@media (prefers-reduced-motion: no-preference) {
  .scan-pulse::after { animation: pulse 2.2s ease-out infinite; }
  @keyframes pulse { 0% { transform: scale(.65); opacity: .5; } 75%, 100% { transform: scale(1.8); opacity: 0; } }
}

/* Keep the market tab and its controls on a single header row. */
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 58px;
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  padding: 7px 18px; grid-template-columns: none; overflow-x: clip;
}
.topbar-main { min-width: 0; min-height: 0; display: contents; }
.topbar-brand-switch { flex: 0 0 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar .view-switch { width: auto; justify-self: auto; }
.topbar-right { display: none; }
.topbar .overview-actions {
  flex: 1 1 auto; min-width: 0; width: auto; min-height: 42px; margin: 0;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 5px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
}
.topbar .overview-filter-button { flex: 0 0 auto; min-height: 30px; padding: 0 9px; white-space: nowrap; }
.overview-icon-button { flex: 0 0 auto; display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid #454545; border-radius: 6px; background: #2a2a2a; color: #c7c7c7; }
.overview-icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.overview-icon-button:hover, .overview-icon-button:focus-visible { border-color: #6e8976; color: #ecfff2; background: #334038; }
.overview-icon-button[aria-pressed="true"], .overview-icon-button[aria-expanded="true"] { border-color: #679a79; color: var(--green); background: #293c30; }
.topbar #overview-view-open { margin-left: auto; }
#overview-fullscreen-exit { position: fixed; z-index: 25; top: 9px; right: 9px; width: 34px; height: 34px; opacity: .45; background: #242424; }
#overview-fullscreen-exit:hover, #overview-fullscreen-exit:focus-visible { opacity: 1; }
body.overview-immersive .topbar, body.overview-immersive main > footer { display: none; }
body.overview-immersive.market-view main { padding-top: 4px; }
.topbar .overview-card-mode { flex: 0 0 auto; }
.topbar .overview-grid-control, .topbar .overview-timeframe-control,
.topbar .overview-sort-control, .topbar .overview-preset-control { flex: 0 0 auto; margin-left: 0; }
.topbar .overview-sort-control select { min-width: 118px; }
.topbar .overview-preset-control select { min-width: 112px; max-width: 150px; }
.topbar .overview-timeframe-control select { min-width: 88px; }
.topbar .overview-grid-control select { min-width: 82px; }
main { padding-top: 18px; }
@media (max-width: 1250px) {
  .topbar { gap: 9px; padding-right: 12px; padding-left: 12px; }
  .topbar-brand-switch { gap: 7px; }
  .topbar .brand { gap: 6px; }
  .topbar .brand-name { font-size: 13px; }
  .topbar .overview-actions { gap: 4px; padding: 4px; }
  .topbar .overview-card-mode > span, .topbar .overview-grid-control > span { display: none; }
  .topbar .overview-sort-control select { min-width: 105px; }
  .topbar .overview-preset-control select { min-width: 95px; max-width: 125px; }
}
@media (max-width: 900px) {
  .topbar { min-height: 54px; gap: 7px; padding: 6px 9px; }
  .topbar-brand-switch { gap: 5px; }
  .topbar .brand-name { display: none; }
  .topbar .view-switch { padding: 2px; }
  .topbar .view-button { min-height: 30px; padding: 0 7px; }
  .topbar .overview-actions { min-height: 38px; gap: 4px; }
  .topbar .overview-filter-button { min-height: 28px; padding: 0 7px; font-size: 10px; }
  .topbar .overview-card-mode button { padding: 0 6px; }
  .topbar .overview-sort-control select { min-width: 96px; }
  .topbar .overview-preset-control select { min-width: 88px; max-width: 105px; }
  .topbar .overview-timeframe-control select { min-width: 75px; }
  .topbar .overview-grid-control select { min-width: 72px; }
}
@media (max-width: 640px) {
  .topbar { min-height: 50px; gap: 5px; padding: 5px 7px; }
  .topbar .view-button { min-height: 28px; padding: 0 6px; font-size: 10px; }
  .topbar .overview-actions { min-height: 36px; gap: 4px; padding: 3px; }
  .topbar .overview-filter-button { padding: 0 6px; }
  .topbar .overview-card-mode button { min-height: 26px; padding: 0 5px; font-size: 9px; }
  .topbar .overview-sort-control select { min-width: 91px; }
  .topbar .overview-preset-control select { min-width: 82px; max-width: 95px; }
  .topbar .overview-timeframe-control select { min-width: 68px; }
  .topbar .overview-grid-control select { min-width: 66px; }
  main { padding: 16px 12px 18px; }
}

.market-view main { width: 100%; max-width: none; padding: 5px 8px 3px; }
.market-view .overview-pagination { gap: 8px; height: 22px; margin: 4px 0 2px; font-size: 10px; }
.market-view .overview-pagination button { min-width: 54px; height: 22px; padding: 0 7px; border-radius: 4px; font-size: 10px; }
.market-view main > footer { gap: 8px; padding-top: 3px; font-size: 8px; line-height: 1.2; }
@media (max-width: 640px) {
  .market-view main { padding: 4px 4px 3px; }
}

/* Keep native select semantics while styling the picker in supporting browsers. */
@supports (appearance: base-select) {
  select, select::picker(select) { appearance: base-select; }
  select { align-items: center; transition: border-color .14s ease, background-color .14s ease; }
  select:hover { border-color: #5c685f; background-color: #2c302d; }
  select:open { border-color: #6d9478; background-color: #2c3830; }
  select::picker-icon {
    content: ""; flex: 0 0 14px; width: 14px; height: 14px; margin-left: 5px;
    background: center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a8b5aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    transition: transform .14s ease;
  }
  select:open::picker-icon { transform: rotate(180deg); }
  select::picker(select) {
    max-height: min(350px, calc(100vh - 32px)); margin-top: 5px; padding: 5px;
    overflow: auto; border: 1px solid #4b554e; border-radius: 9px;
    background: #242724; color: #e4e9e4; box-shadow: 0 14px 34px #000b;
    scrollbar-color: #535d55 #242724;
  }
  select::picker(select) option {
    display: flex; align-items: center; min-height: 31px; margin: 1px 0; padding: 5px 9px;
    border-radius: 5px; background: transparent; color: #d9dfd9;
    font-size: 11px; line-height: 1.2; white-space: nowrap;
  }
  select::picker(select) option:checked { background: #304239; color: #a4e8bf; }
  select::picker(select) option:hover, select::picker(select) option:focus-visible { background: #394a40; color: #f3fff5; }
  select::picker(select) option::checkmark { display: none; }
  .topbar .overview-actions select { padding-right: 7px; padding-left: 8px; }
}
.topbar .overview-timeframe-control select { width: 82px; min-width: 82px; max-width: 82px; }
.topbar .overview-grid-control select { width: 58px; min-width: 58px; max-width: 58px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #171918; color: #e6eae6; }
.auth-card, .account-shell { width: min(100%, 430px); padding: 30px; border: 1px solid #353b36; border-radius: 14px; background: #202321; box-shadow: 0 24px 70px #0006; }
.auth-mark { display: flex; align-items: end; gap: 3px; height: 22px; margin-bottom: 19px; }
.auth-mark i { width: 5px; border-radius: 3px; background: #42d392; }
.auth-mark i:nth-child(1) { height: 9px; }.auth-mark i:nth-child(2) { height: 18px; }.auth-mark i:nth-child(3) { height: 13px; }
.auth-eyebrow { color: #68dba4; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auth-page h1 { margin: 7px 0 8px; font-size: 25px; line-height: 1.2; }
.auth-description { margin: 0 0 22px; color: #a6afa8; font-size: 13px; line-height: 1.5; }
.auth-page form { display: grid; gap: 9px; }
.auth-page label { margin-top: 9px; color: #c8d0c9; font-size: 12px; }
.auth-page input { width: 100%; height: 39px; padding: 0 11px; border: 1px solid #475048; border-radius: 7px; outline: none; background: #191c1a; color: #eef5ef; font-size: 14px; }
.auth-page input:focus { border-color: #42d392; }
.auth-page button { min-height: 38px; padding: 0 14px; border: 1px solid #4b6554; border-radius: 7px; background: #274634; color: #d8ffe5; font-size: 13px; }
.auth-page button:hover { background: #315c42; }
.auth-page form > button { margin-top: 13px; }
.auth-page button:disabled { opacity: .55; cursor: wait; }
.auth-message { margin: 5px 0 0; color: #f2a9ac; font-size: 12px; line-height: 1.4; }
.account-page { place-items: start center; }
.account-shell { width: min(100%, 680px); }
.account-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account-top a { color: #91d9ad; text-decoration: none; font-size: 13px; }
.account-top a:hover { text-decoration: underline; }
.account-top button { min-height: 32px; background: #292e2a; color: #e1e6e1; }
.account-heading { margin: 26px 0; }
.account-heading p { color: #b3bcb4; font-size: 13px; }
.auth-notice { padding: 12px; border: 1px solid #6c6244; border-radius: 7px; background: #403a27; color: #f2dda0; font-size: 13px; }
.account-section { margin-top: 22px; padding-top: 22px; border-top: 1px solid #353b36; }
.account-section h2 { margin: 0 0 10px; font-size: 16px; }
.invite-form { grid-template-columns: 1fr auto; align-items: end; }
.invite-form label { grid-column: 1 / -1; }
.invite-form button { margin: 0 !important; }
.invite-result { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 14px; padding: 12px; border: 1px solid #58745f; border-radius: 7px; background: #26382d; font-size: 12px; }
.invite-result span { flex-basis: 100%; }
.invite-result code { font-size: 13px; overflow-wrap: anywhere; }
.invite-result button { min-height: 29px; }
.user-list { margin-top: 17px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid #333934; color: #c9d0c9; font-size: 12px; }
.user-row span { overflow-wrap: anywhere; }
.user-row button { min-height: 28px; border-color: #625052; background: #35292b; color: #f2c7cb; }
@media (max-width: 520px) { .auth-card, .account-shell { padding: 20px; }.invite-form { grid-template-columns: 1fr; } }
