:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: #0c1422;
  --card: #101b2d;
  --card-raised: #132238;
  --text: #f8fafc;
  --muted: #94a3b8;
  --faint: #64748b;
  --border: #22304a;
  --border-soft: #18253a;
  --green: #22c55e;
  --green-bright: #4ade80;
  --green-soft: #14532d;
  --blue: #38bdf8;
  --red: #fb7185;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --mono: 'Cascadia Code', Consolas, 'Courier New', monospace;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 360px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 360px; min-height: 100vh; background: var(--bg); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-frame { min-height: 100vh; }

.rail { position: fixed; inset: 0 auto 0 0; z-index: 5; width: 70px; display: flex; flex-direction: column; align-items: center; padding: 18px 0 15px; background: #080e19; border-right: 1px solid var(--border-soft); }
.brand-mark, .rail-link { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; text-decoration: none; }
.brand-mark { margin-bottom: 38px; }
.brand-glyph { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 11px; color: #07120c; background: linear-gradient(145deg, #4ade80, #16a34a); font-size: 21px; font-weight: 800; box-shadow: 0 5px 22px #22c55e33; }
.brand-glyph.small { width: 26px; height: 26px; border-radius: 7px; font-size: 14px; }
.rail-nav, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rail-bottom { margin-top: auto; }
.rail-link { color: #75849c; border: 0; background: transparent; cursor: pointer; transition: color .18s ease, background .18s ease; }
.rail-link:hover, .rail-link.active { color: var(--green-bright); background: #12291f; }
.rail-link svg { width: 19px; height: 19px; }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid #345143; border-radius: 50%; color: #b8f2ca; background: #10271d; font: 500 10px var(--mono); }

.workspace { min-height: 100vh; margin-left: 70px; }
.topbar { position: sticky; top: 0; z-index: 4; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--border-soft); background: #080e19ee; backdrop-filter: blur(15px); }
.topbar-brand, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-brand { color: #dce5f1; font-size: 11px; font-weight: 800; letter-spacing: .13em; }
.brand-divider { width: 1px; height: 17px; background: var(--border); margin: 0 3px; }
.topbar-section { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.topbar-clock { color: var(--faint); font: 11px var(--mono); }
.connection-status { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: #0d1725; font-size: 10px; font-weight: 700; letter-spacing: .025em; }
.status-dot, .live-indicator, .security-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.connection-status.online .status-dot, .live-indicator { background: var(--green); box-shadow: 0 0 9px #22c55e77; }
.connection-status.offline .status-dot { background: var(--red); box-shadow: 0 0 9px #fb718577; }
.connection-status.online { color: #a7f3c0; border-color: #1d5737; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; transition: all .18s ease; }
.icon-button:hover { color: var(--text); border-color: var(--border); background: var(--card); }
.icon-button svg { width: 17px; height: 17px; }
.accent-icon { color: var(--green-bright); border-color: #1e4934; background: #10251b; }
.accent-icon:hover { color: #07120c; background: var(--green); }

.page-content { max-width: 1750px; margin: 0 auto; padding: 31px 34px 22px; }
.indicator-lab-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr); align-items: stretch; gap: 15px; }
.indicator-tools-column { display: grid; grid-template-rows: minmax(500px, 1fr) auto; align-content: stretch; gap: 15px; min-width: 0; }
.indicator-assistant-panel { display: flex; min-height: 500px; flex-direction: column; }
.indicator-assistant-panel > .panel-heading { align-items: flex-start; }
.indicator-assistant-panel .panel-heading .eyebrow { margin-bottom: 5px; }
.indicator-assistant-panel .panel-heading h2 { font-size: 14px; }
.indicator-assistant-note { max-width: 560px; margin: 5px 0 0; color: var(--faint); font-size: 9px; line-height: 1.55; }
.indicator-assistant-state { flex: 0 0 auto; padding: 5px 8px; border: 1px solid #24583a; border-radius: 6px; color: #8ce7a8; background: #10251b; font: 8px var(--mono); }
.indicator-ai-form { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 11px; padding: 0 15px 15px; }
.indicator-ai-select-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.indicator-ai-form .settings-field { gap: 5px; }
.indicator-ai-form .settings-field > span:first-child { color: #a6b4c7; font-size: 9px; font-weight: 700; }
.indicator-ai-model-field { min-width: 0; }
.indicator-ai-model-field .settings-model-input { gap: 6px; }
.indicator-ai-model-field .form-input, .indicator-ai-model-field .button { min-height: 36px; font-size: 9px; }
.indicator-ai-model-field .button { min-width: 58px; padding: 0 10px; }
.indicator-ai-field-help { color: var(--faint); font-size: 8px; line-height: 1.4; }
.indicator-ai-model-field .form-input:disabled { color: var(--faint); cursor: not-allowed; opacity: .8; }
.indicator-ai-conversation { display: grid; min-height: 150px; flex: 1; align-content: start; gap: 8px; overflow: auto; padding: 11px; border: 1px solid #1d2c40; border-radius: 8px; background: #070d17; scrollbar-color: #25344b transparent; scrollbar-width: thin; }
.indicator-ai-message { max-width: min(88%, 940px); margin: 0; padding: 7px 9px; border: 1px solid #1e3045; border-radius: 7px; color: #c1ccda; background: #0d1725; font: 9px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.indicator-ai-message.assistant { justify-self: start; }
.indicator-ai-message.user { justify-self: end; border-color: #24583a; color: #d4f7df; background: #10251b; }
.indicator-ai-message.error { border-color: #65313b; color: #ffb7c0; background: #28171e; }
.indicator-ai-prompt { min-height: 72px; padding: 9px 10px; resize: vertical; line-height: 1.5; }
.indicator-ai-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.indicator-ai-actions .subtle-label { max-width: 250px; font-size: 8px; line-height: 1.45; }
.indicator-ai-actions .button { flex: 0 0 auto; }
.indicator-library-panel .indicator-list-help { margin: 0 15px 13px; }
.indicator-library-panel > .button { margin: 0 15px 15px; }
.indicator-editor-body { display: grid; gap: 13px; padding: 0 16px 16px; }
.indicator-editor-body .settings-field { display: grid; gap: 6px; }
.indicator-editor-body .settings-field > span { color: #a6b4c7; font-size: 9px; font-weight: 700; }
.indicator-code-editor { width: 100%; min-height: 280px; resize: vertical; padding: 14px; border: 1px solid #263852; border-radius: 8px; outline: none; color: #b8e8ca; background: #070d17; font: 11px/1.7 var(--mono); tab-size: 2; }
.indicator-code-editor:focus { border-color: #28774a; box-shadow: 0 0 0 2px #22c55e18; }
.indicator-language-note { padding: 11px; border: 1px solid #1b2c40; border-radius: 7px; color: var(--muted); background: #0a1220; font-size: 9px; line-height: 1.7; }
.indicator-language-note strong { color: #d4e0ec; }
.indicator-language-note code { color: #7dd3fc; font: 9px var(--mono); }
.indicator-compile-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.indicator-compile-row > div { display: flex; gap: 8px; }
.indicator-compile-status { color: var(--muted); font-size: 9px; }
.indicator-compile-status.success { color: #86efac; }
.indicator-compile-status.error { color: #fda4af; }
.indicator-diagnostics { display: grid; gap: 6px; min-height: 36px; padding: 10px; border: 1px solid #1b2a3d; border-radius: 7px; background: #080e19; font: 9px/1.5 var(--mono); }
.indicator-diagnostic { color: #fda4af; }
.indicator-diagnostic.success { color: #86efac; }
.indicator-list-help { margin: 0 15px 10px; color: var(--faint); font-size: 9px; line-height: 1.5; }
.indicator-definition-list { display: grid; gap: 6px; max-height: 510px; overflow: auto; padding: 0 9px 10px; scrollbar-color: #25344b transparent; scrollbar-width: thin; }
.indicator-definition-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 55px; padding: 9px 10px; border: 1px solid #1a2a3e; border-radius: 7px; background: #0a1220; }
.indicator-definition-row.catalog { grid-template-columns: minmax(0, 1fr) auto auto; }
.indicator-definition-row.selection { grid-template-columns: minmax(0, 1fr) auto; }
.indicator-definition-main { min-width: 0; display: flex; align-items: flex-start; gap: 9px; }
.indicator-definition-main input { margin: 3px 0 0; accent-color: var(--green); }
.indicator-definition-main strong { display: block; color: #e2eaf4; font-size: 10px; }
.indicator-definition-main small { display: block; margin-top: 4px; color: var(--faint); font-size: 8px; line-height: 1.4; }
.indicator-type-chip { padding: 3px 5px; border: 1px solid #294058; border-radius: 4px; color: #90a7be; font: 7px var(--mono); text-transform: uppercase; }
.indicator-type-chip.custom { border-color: #3d3566; color: #c4b5fd; }
.indicator-delete { padding: 4px 6px; border: 0; color: #fb7185; background: transparent; font-size: 8px; cursor: pointer; }
.indicator-values { padding: 12px 14px 14px; border-top: 1px solid var(--border-soft); }
.indicator-values > .eyebrow { margin-bottom: 8px; font-size: 8px; }
.indicator-value-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.indicator-value-item { min-width: 0; padding: 8px; border: 1px solid #1a2a3e; border-radius: 6px; background: #0a1220; }
.indicator-value-item span { display: block; overflow: hidden; color: var(--faint); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.indicator-value-item strong { display: block; overflow: hidden; margin-top: 5px; color: #e2eaf4; font: 10px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.indicator-value-item small { display: block; overflow: hidden; margin-top: 3px; color: #8493a8; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.pair-indicators-modal { width: min(900px, calc(100vw - 28px)); overflow: hidden; }
.pair-indicators-content { display: grid; grid-template-rows: auto auto minmax(90px, 1fr) minmax(70px, auto); gap: 12px; max-height: calc(100vh - 32px); padding: 20px; }
.pair-indicators-content > .modal-top { align-items: flex-start; margin: 0; }
.pair-indicators-content .modal-top h2 { font-size: 17px; }
.pair-indicators-content .indicator-list-help { margin: 6px 0 0; }
.pair-indicator-timeframe { grid-template-columns: 1fr; max-width: 180px; }
.pair-indicator-list { min-height: 90px; max-height: min(42vh, 430px); padding: 0 4px 6px; }
.pair-indicator-values { max-height: min(28vh, 270px); overflow: auto; padding: 11px 4px 2px; scrollbar-color: #25344b transparent; scrollbar-width: thin; }
.indicator-catalog-modal { width: min(740px, calc(100vw - 28px)); }
.indicator-catalog-content { display: grid; grid-template-rows: auto minmax(90px, 1fr); gap: 10px; max-height: calc(100vh - 32px); padding: 20px; }
.indicator-catalog-content > .modal-top { align-items: flex-start; margin: 0; }
.indicator-catalog-content .modal-top h2 { font-size: 17px; }
.indicator-catalog-content .indicator-list-help { margin: 6px 0 0; }
.catalog-dialog-list { max-height: min(68vh, 680px); padding: 0 4px 4px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: #71d995; font: 500 9px var(--mono); letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin: 0; color: #f4f7fb; font-size: clamp(25px, 2.2vw, 31px); line-height: 1.2; font-weight: 700; letter-spacing: -.045em; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.heading-actions { display: flex; gap: 9px; }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button-quiet { color: #c4cfdf; border-color: var(--border); background: #111a29; }
.button-quiet:hover { border-color: #3b4b64; background: #172338; }
.button-primary { color: #06140b; background: var(--green); box-shadow: 0 4px 14px #22c55e1d; }
.button-primary:hover { background: #4ade80; }
.play-icon { font-size: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.stat-card { min-height: 106px; padding: 14px 16px 12px; border: 1px solid var(--border-soft); border-radius: 11px; background: linear-gradient(145deg, #0e1827, #0b1320); box-shadow: 0 5px 18px #00000015; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: #9aa8bb; font-size: 10px; font-weight: 600; }
.stat-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 7px; font-size: 14px; font-weight: 700; }
.icon-blue { color: #7dd3fc; background: #0f2a3c; }
.icon-green { color: var(--green-bright); background: #10271d; }
.icon-violet { color: #c4b5fd; background: #221d3b; }
.icon-amber { color: #fcd34d; background: #302514; }
.stat-card strong { display: block; margin-top: 7px; color: #f4f7fb; font: 600 22px var(--mono); letter-spacing: -.06em; }
.stat-card strong.negative { color: var(--red); }
.stat-card small { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; }

.terminal-layout { display: grid; grid-template-columns: minmax(235px, 270px) minmax(0, 1fr); align-items: start; gap: 15px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 11px; background: var(--panel); box-shadow: 0 7px 24px #00000013; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 17px 13px; }
.panel-heading .eyebrow { margin-bottom: 5px; font-size: 8px; }
h2 { margin: 0; color: #eef3f9; font-size: 14px; font-weight: 700; letter-spacing: -.025em; }
.count-badge { display: inline-grid; min-width: 18px; height: 18px; place-items: center; margin-left: 4px; padding: 0 5px; border-radius: 5px; color: #a5f3bd; background: #153524; font: 10px var(--mono); vertical-align: 1px; }
.watchlist-panel { position: sticky; top: 78px; }
.watchlist-tools { padding: 0 12px 11px; }
.search-field { display: flex; height: 32px; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--border-soft); border-radius: 7px; color: var(--faint); background: #09111e; }
.search-field svg { width: 14px; height: 14px; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.search-field input::placeholder { color: #68778c; }
.search-field:focus-within { border-color: #2d7248; }
.pair-list { max-height: calc(100vh - 320px); min-height: 90px; overflow: auto; padding: 0 7px 7px; scrollbar-color: #25344b transparent; scrollbar-width: thin; }
.pair-row { position: relative; display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 9px; border: 1px solid transparent; border-radius: 8px; color: var(--text); background: transparent; text-align: left; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.pair-row:hover { background: #111c2b; }
.pair-row.selected { border-color: #1e4835; background: linear-gradient(110deg, #12271e, #101c29); }
.pair-main { min-width: 0; display: flex; align-items: center; gap: 9px; }
.pair-symbol-mark { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border: 1px solid #263750; border-radius: 8px; color: #a4c4d8; background: #132237; font: 8px var(--mono); }
.pair-row.selected .pair-symbol-mark { border-color: #286043; color: #b5f4c6; background: #173222; }
.pair-names { min-width: 0; }
.pair-names strong { display: block; overflow: hidden; color: #e8eef6; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pair-names small { display: block; overflow: hidden; margin-top: 3px; color: var(--faint); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.pair-price { text-align: right; }
.pair-price strong { display: block; color: #dce7f2; font: 9px var(--mono); }
.pair-price small { display: block; margin-top: 4px; color: var(--faint); font-size: 8px; }
.pair-dot { position: absolute; top: 8px; left: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.pair-dot.running { background: var(--green); box-shadow: 0 0 7px #22c55e88; }
.watchlist-footer { min-height: 38px; display: flex; align-items: center; gap: 7px; padding: 0 12px; border-top: 1px solid var(--border-soft); color: var(--faint); font-size: 8px; }
.watchlist-footer .text-button { margin-left: auto; }
.live-indicator { width: 6px; height: 6px; }
.text-button { padding: 3px 2px; border: 0; color: #75db98; background: transparent; font-size: 9px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: #b9f6c9; text-decoration: underline; }
.danger-link { color: #f891a1; }
.danger-link:hover { color: #fecdd3; }
.market-workspace { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(245px, .9fr); gap: 14px; }
.chart-panel { grid-column: 1; }
.chart-heading { min-height: 77px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px 10px; }
.selected-market { display: flex; min-width: 0; align-items: center; gap: 11px; }
.instrument-avatar { display: grid; width: 39px; height: 39px; flex: 0 0 39px; place-items: center; border: 1px solid #27443b; border-radius: 11px; color: #a7e9bc; background: #13281d; font: 10px var(--mono); }
.instrument-title-row { display: flex; align-items: center; gap: 8px; }
.instrument-title-row h2 { font-size: 14px; }
.instrument-code { margin: 4px 0 0; color: var(--faint); font-size: 9px; }
.feed-badge { display: inline-flex; align-items: center; padding: 3px 6px; border: 1px solid #384559; border-radius: 5px; color: #a7b2c3; background: #152033; font: 8px var(--mono); text-transform: uppercase; }
.feed-badge.live { color: #96efb2; border-color: #215538; background: #10271b; }
.feed-badge.error, .feed-badge.disconnected { color: #f7a1ad; border-color: #67313a; background: #311a22; }
.price-block { text-align: right; }
.price-block .price-caption { margin: 0 0 4px; color: var(--faint); font: 7px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.price-block strong { display: block; color: #f5f8fc; font: 600 18px var(--mono); letter-spacing: -.05em; }
.price-block span { display: block; margin-top: 4px; color: var(--faint); font-size: 8px; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 17px 9px; border-bottom: 1px solid var(--border-soft); }
.timeframes { display: flex; align-items: center; gap: 4px; }
.timeframe { min-width: 32px; height: 26px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; color: #78879d; background: transparent; font: 9px var(--mono); cursor: pointer; transition: all .16s ease; }
.timeframe:hover { color: #dbe7f1; background: #142135; }
.timeframe.active { color: #a7f3bd; border-color: #214b36; background: #12271c; }
.chart-legend { display: flex; gap: 10px; color: var(--faint); font-size: 8px; }
.chart-legend span { display: flex; align-items: center; gap: 4px; }
.chart-legend i { width: 6px; height: 6px; border-radius: 2px; }
.chart-indicator-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-indicator-legend span { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-indicator-legend i { width: 9px; height: 2px; border-radius: 0; }
.legend-green { background: var(--green); }
.legend-red { background: var(--red); }
.chart-wrap { position: relative; height: 250px; overflow: hidden; padding: 6px 10px 0; }
#price-chart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: #73849b; font-size: 10px; text-align: center; pointer-events: none; }
.chart-empty.hidden { display: none; }
.chart-zoom-controls { position: absolute; z-index: 2; top: 10px; right: 15px; display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid #26364d; border-radius: 7px; background: rgb(8 15 27 / 92%); box-shadow: 0 4px 14px rgb(0 0 0 / 24%); }
.chart-zoom-controls output { min-width: 48px; color: #91a4bd; font: 8px var(--mono); text-align: center; }
.chart-zoom-button, .chart-zoom-reset { height: 24px; border: 1px solid transparent; border-radius: 4px; color: #dbe7f1; background: transparent; cursor: pointer; }
.chart-zoom-button { width: 24px; font: 15px/1 var(--mono); }
.chart-zoom-reset { padding: 0 7px; color: #9aabc1; font-size: 8px; }
.chart-zoom-button:hover:not(:disabled), .chart-zoom-reset:hover:not(:disabled) { border-color: #28405d; color: #a7f3bd; background: #142135; }
.chart-zoom-button:disabled, .chart-zoom-reset:disabled { opacity: .4; cursor: default; }
.quote-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border-soft); }
.quote-strip > div { display: grid; gap: 5px; padding: 10px 13px; border-right: 1px solid var(--border-soft); }
.quote-strip > div:last-child { border-right: 0; }
.quote-strip span { color: var(--faint); font-size: 8px; }
.quote-strip strong { color: #dbe6f2; font: 10px var(--mono); }
.market-side { grid-column: 2; grid-row: 1; display: grid; align-content: stretch; gap: 14px; }
.conditions-card { grid-column: 1 / -1; }
.market-card, .trade-plan-card { padding-bottom: 12px; }
.compact-heading { padding-bottom: 12px; }
.signal-pill { padding: 4px 7px; border: 1px solid #344156; border-radius: 5px; color: #c0cad7; background: #172234; font: 8px var(--mono); letter-spacing: .04em; }
.signal-pill.buy { color: #a4f2bb; border-color: #245d3d; background: #13301e; }
.signal-pill.sell { color: #ffb1bb; border-color: #6d3741; background: #341c25; }
.indicator-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 15px; }
.indicator { min-height: 64px; display: flex; flex-direction: column; justify-content: center; padding: 8px 14px; border-top: 1px solid var(--border-soft); }
.indicator:not(:nth-child(4n)) { border-right: 1px solid var(--border-soft); }
.indicator:nth-child(4n + 1) { padding-left: 4px; }
.indicator:nth-child(4n) { padding-right: 4px; }
.indicator span { color: var(--faint); font-size: 8px; }
.indicator strong { overflow: hidden; margin-top: 5px; color: #e5edf5; font: 11px var(--mono); text-overflow: ellipsis; }
.indicator small { margin-top: 3px; color: #77879b; font-size: 8px; }
.bias-row { margin: 4px 15px 0; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.bias-row > span { display: block; margin-bottom: 8px; color: var(--faint); font-size: 8px; }
.bias-list { display: flex; flex-wrap: wrap; gap: 5px; }
.bias-chip { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; color: #bdc8d6; background: #111d2d; font: 8px var(--mono); }
.bias-chip.bull { color: #a7f3bd; border-color: #24583a; background: #11261a; }
.bias-chip.bear { color: #f5a9b4; border-color: #5b313b; background: #2b1920; }
.muted { color: var(--faint); font-size: 9px; }
.mini-shield { padding: 4px 6px; border: 1px solid #2d4059; border-radius: 5px; color: #9eb1c8; background: #142034; font: 8px var(--mono); }
.setup-explanation { min-height: 37px; margin: 0 15px 9px; color: #9baabe; font-size: 9px; line-height: 1.55; }
.timeframe-plan-section { grid-column: 1 / -1; }
.timeframe-plan-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 15px 15px; }
.timeframe-plan-empty { grid-column: 1 / -1; padding: 10px; border: 1px dashed #26364c; border-radius: 6px; color: var(--faint); font-size: 9px; line-height: 1.45; }
.timeframe-plan-mini-card { min-width: 0; padding: 9px; border: 1px solid #223149; border-radius: 7px; background: #0e1928; }
.timeframe-plan-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timeframe-plan-card-heading > div { display: flex; min-width: 0; align-items: baseline; gap: 6px; }
.timeframe-plan-card-heading strong { color: #e1eaf4; font: 10px var(--mono); }
.timeframe-plan-role { overflow: hidden; color: var(--faint); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.timeframe-plan-action { padding: 3px 5px; border: 1px solid #38465a; border-radius: 4px; color: #b9c5d3; background: #182334; font: 8px var(--mono); }
.timeframe-plan-action.buy { color: #a4f2bb; border-color: #245d3d; background: #13301e; }
.timeframe-plan-action.sell { color: #ffb1bb; border-color: #6d3741; background: #341c25; }
.timeframe-plan-copy { margin: 7px 0; color: #bdc9d8; font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.timeframe-plan-position { padding-top: 6px; border-top: 1px solid #1a293d; color: #8191a5; font: 8px var(--mono); line-height: 1.4; }
.timeframe-plan-position.open { color: #f0c77c; }
.timeframe-plan-time { display: block; margin-top: 5px; color: #65758a; font-size: 7px; }
.timeframe-plan-details { margin-top: 6px; color: #8293a9; font-size: 8px; }
.timeframe-plan-details summary { cursor: pointer; }
.timeframe-plan-details p { margin: 5px 0 0; color: #91a1b4; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.levels-list { margin: 0 15px; border-top: 1px solid var(--border-soft); }
.levels-list > div, .risk-row { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #152135; }
.levels-list span, .risk-row span { color: var(--faint); font-size: 8px; }
.levels-list strong, .risk-row strong { color: #dce6f1; font: 9px var(--mono); text-align: right; }
.text-red { color: #fb9ba7 !important; }
.text-green { color: #8ce7a8 !important; }
.risk-row { margin: 0 15px; border-bottom: 0; }
.pair-controls { display: flex; gap: 7px; margin: 8px 15px 0; }
.pair-controls .button { min-height: 32px; padding: 0 8px; font-size: 9px; }
.pair-controls .button-quiet { color: #b9c4d2; }
.grow { flex: 1; }
.pair-secondary-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 15px 0; padding-top: 7px; border-top: 1px solid var(--border-soft); }
.toggle-row { position: relative; display: inline-flex; align-items: center; gap: 7px; color: #a6b2c1; font-size: 9px; cursor: pointer; }
.toggle-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-ui { position: relative; width: 27px; height: 15px; border: 1px solid #344155; border-radius: 999px; background: #1c293b; transition: background .18s ease; }
.toggle-ui::after { position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; content: ''; transition: transform .18s ease, background .18s ease; }
.toggle-row input:checked + .toggle-ui { border-color: #32814d; background: #1c7040; }
.toggle-row input:checked + .toggle-ui::after { transform: translateX(12px); background: white; }
.toggle-row input:focus-visible + .toggle-ui { outline: 2px solid var(--green); outline-offset: 2px; }
.models-panel, .activity-panel { grid-column: 1 / -1; }
.models-panel > .panel-heading .table-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pair-ai-control { display: inline-flex; align-items: center; gap: 8px; min-height: 31px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; background: #0a1220; }
.pair-ai-control-label { color: #a6b4c7; font-size: 9px; font-weight: 650; white-space: nowrap; }
.pair-ai-control .toggle-row { gap: 0; }
.pair-ai-state { min-width: 22px; color: var(--faint); font: 8px var(--mono); text-align: center; }
.pair-ai-state.on { color: #86efac; }
.pair-ai-state.off { color: #94a3b8; }
.activity-panel .table-scroll { max-height: 360px; overflow: auto; }
.activity-panel thead { position: sticky; top: 0; z-index: 1; }
.trade-chart-note { margin: 5px 0 0; color: var(--faint); font-size: 8px; font-weight: 400; }
.subtle-label { color: var(--faint); font-size: 9px; }
.table-scroll { width: 100%; overflow-x: auto; scrollbar-color: #27374f transparent; scrollbar-width: thin; }
#activity table, .models-panel table { width: 100%; border-collapse: collapse; text-align: left; }
#activity thead, .models-panel thead { border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); background: #0a1220; }
#activity th, .models-panel th { padding: 9px 13px; color: #76869a; font: 8px var(--mono); font-weight: 400; letter-spacing: .035em; white-space: nowrap; }
#activity td, .models-panel td { max-width: 220px; padding: 9px 13px; border-bottom: 1px solid #152033; color: #b8c4d3; font-size: 9px; vertical-align: middle; }
#activity tbody tr:last-child td, .models-panel tbody tr:last-child td { border-bottom: 0; }
#activity td:first-child, .models-panel td:first-child { color: #e0e8f1; }
.table-empty { padding: 18px; color: var(--faint) !important; text-align: center; }
.model-name { display: block; overflow: hidden; max-width: 220px; color: #dce6f0; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.model-role { display: block; margin-top: 3px; color: var(--faint); font-size: 8px; }
.state-chip, .trade-state { display: inline-flex; align-items: center; padding: 4px 6px; border: 1px solid #303e52; border-radius: 5px; color: #bfcbda; background: #162235; font: 8px var(--mono); white-space: nowrap; }
.state-chip.running { color: #a7f3bd; border-color: #24583a; background: #11271b; }
.state-chip.error, .state-chip.ratelimited { color: #ffb1bb; border-color: #64313b; background: #311a21; }
.state-chip.disabled { color: #9ca9b9; }
.decision-cell { overflow: hidden; max-width: 250px; color: #96a6b9; text-overflow: ellipsis; white-space: nowrap; }
.model-decision-cell { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 460px; }
.decision-summary { display: block; min-width: 0; overflow: hidden; color: #96a6b9; text-overflow: ellipsis; white-space: nowrap; }
.model-logs-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 15px 0; padding: 13px 0 12px; border-top: 1px solid var(--border-soft); }
.model-logs-heading .eyebrow { margin: 0 0 4px; }
.model-logs-heading h3 { margin: 0; color: #dce6f0; font-size: 12px; font-weight: 650; }
.log-open-button { min-height: 30px; padding: 0 9px; font-size: 9px; }
.log-count-badge { display: inline-grid; min-width: 19px; height: 19px; place-items: center; padding: 0 5px; border: 1px solid #29405b; border-radius: 5px; color: #a9c3dd; background: #0a1422; font: 8px var(--mono); }
.log-state, .log-decision { padding: 4px 6px; border: 1px solid #303e52; border-radius: 5px; color: #bfcbda; background: #162235; font: 8px var(--mono); white-space: nowrap; }
.log-state.completed { border-color: #24583a; color: #a7f3bd; background: #11271b; }
.log-state.running, .log-state.waiting { border-color: #24516a; color: #9edcf7; background: #112535; }
.log-state.error, .log-state.ratelimited { border-color: #64313b; color: #ffb1bb; background: #311a21; }
.log-decision.buy { border-color: #24583a; color: #a7f3bd; background: #11271b; }
.log-decision.sell { border-color: #64313b; color: #ffb1bb; background: #311a21; }
.log-decision.wait { border-color: #6a5422; color: #f6d278; background: #292215; }
.log-decision.analyzing, .log-decision.queued { border-color: #24516a; color: #9edcf7; background: #112535; }
.log-decision.error, .log-decision.disabled { border-color: #64313b; color: #ffb1bb; background: #311a21; }
.log-decision.ratelimited { border-color: #76502b; color: #ffc27c; background: #302215; }
.log-decision.no-decision { color: #9ca9b9; }
.model-console-modal { width: min(1040px, calc(100vw - 28px)); max-width: none; max-height: calc(100vh - 28px); margin: auto; padding: 0; overflow: hidden; border: 1px solid #2a3a52; border-radius: 12px; color: var(--text); background: #060a14; box-shadow: 0 24px 80px #000b; }
.model-console-modal::backdrop { background: #030710d9; backdrop-filter: blur(5px); }
.model-console-modal[open] { display: grid; }
.signal-audit-modal { width: min(1020px, calc(100vw - 28px)); max-width: none; max-height: calc(100vh - 28px); margin: auto; padding: 0; overflow: hidden; border: 1px solid #2a3a52; border-radius: 12px; color: var(--text); background: #060a14; box-shadow: 0 24px 80px #000b; }
.signal-audit-modal::backdrop { background: #030710d9; backdrop-filter: blur(5px); }
.signal-audit-modal[open] { display: grid; }
.signal-audit-shell { display: grid; grid-template-rows: auto auto auto auto minmax(100px, 1fr) auto; max-height: calc(100vh - 28px); overflow: hidden; }
.signal-audit-context { display: flex; justify-content: space-between; gap: 12px; padding: 8px 17px; border-bottom: 1px solid #17243a; color: #74859b; background: #09111e; font: 8px var(--mono); }
.signal-audit-context span:last-child { text-align: right; }
.signal-audit-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 17px 8px; }
.signal-audit-toolbar p { max-width: 650px; margin: 0; color: #8b9aaf; font-size: 9px; line-height: 1.55; }
.signal-audit-toolbar .settings-field { width: 180px; flex: 0 0 auto; gap: 5px; }
.signal-audit-toolbar .settings-field > span { color: #77869a; font-size: 8px; }
.signal-audit-toolbar .form-input { min-height: 31px; padding: 0 9px; font-size: 9px; }
.signal-audit-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 17px 10px; }
.signal-audit-stat { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 8px; min-width: 0; padding: 8px 10px; border: 1px solid #1c2a40; border-radius: 7px; background: #0b1422; }
.signal-audit-stat > span { color: #8fa0b6; font-size: 8px; }
.signal-audit-stat > strong { color: #dce6f0; font: 600 12px var(--mono); text-align: right; }
.signal-audit-stat > small { grid-column: 1 / -1; overflow: hidden; color: #63748b; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.signal-audit-list { min-height: 0; max-height: min(61vh, 620px); overflow: auto; padding: 1px 17px 10px; background: #060a14; scrollbar-color: #26354a transparent; scrollbar-width: thin; }
.signal-audit-empty { padding: 22px 5px; color: #7c8ba0; font: 9px/1.6 var(--mono); text-align: center; }
.signal-candidate { margin-bottom: 8px; padding: 11px 12px 9px; border: 1px solid #1d2a3d; border-radius: 8px; background: #0b1320; }
.signal-candidate.blocked { border-left: 2px solid #c75a69; }
.signal-candidate.waiting { border-left: 2px solid #d29b36; }
.signal-candidate.simulated { border-left: 2px solid #36a865; }
.signal-candidate-heading, .signal-candidate-identity { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.signal-candidate-heading { justify-content: space-between; }
.signal-candidate-identity strong { color: #dce6f0; font: 600 9px var(--mono); }
.signal-candidate-identity .trade-side { padding: 4px 6px; border: 1px solid #344156; border-radius: 5px; background: #121c2a; }
.signal-candidate-identity .model-role { display: inline; margin: 0; }
.signal-audit-status { display: inline-flex; align-items: center; padding: 4px 6px; border: 1px solid #334155; border-radius: 5px; color: #b8c4d3; background: #162235; font: 7px var(--mono); }
.signal-audit-status.blocked { border-color: #64313b; color: #ffb1bb; background: #311a21; }
.signal-audit-status.waiting { border-color: #6a5422; color: #f6d278; background: #292215; }
.signal-audit-status.simulated { border-color: #24583a; color: #a7f3bd; background: #11271b; }
.signal-candidate-explanations { display: grid; gap: 4px; margin: 8px 0; }
.signal-candidate-explanations .eyebrow { margin: 0 0 1px; color: #8ba0b8; font-size: 7px; }
.signal-candidate-explanation { margin: 0; padding: 6px 8px; border: 1px solid #253249; border-left: 2px solid #53657d; border-radius: 4px; color: #bac6d5; background: #09111e; font-size: 8px; line-height: 1.55; overflow-wrap: anywhere; }
.signal-candidate-explanation.primary { border-left-color: #dc6875; color: #e6c4c9; }
.signal-candidate.waiting .signal-candidate-explanation.primary { border-left-color: #d29b36; color: #ead9b3; }
.signal-candidate.simulated .signal-candidate-explanation.primary { border-left-color: #36a865; color: #b9dfc7; }
.signal-candidate-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 13px; color: #708198; font: 7px var(--mono); }
.signal-candidate-meta > span { overflow-wrap: anywhere; }
.signal-quote { padding: 3px 5px; border: 1px solid #455165; border-radius: 4px; color: #aab6c6; }
.signal-quote.live { border-color: #24583a; color: #a7f3bd; }
.signal-quote.stale { border-color: #6a5422; color: #f6d278; }
.signal-candidate-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }
.signal-candidate-levels > div { display: grid; gap: 4px; min-width: 0; padding: 7px 8px; border: 1px solid #18263a; border-radius: 5px; background: #080f1b; }
.signal-candidate-levels span, .signal-candidate-context-grid span { color: #718197; font-size: 7px; }
.signal-candidate-levels strong, .signal-candidate-context-grid strong { color: #cbd7e5; font: 8px var(--mono); overflow-wrap: anywhere; }
.signal-candidate-levels .stop-price { color: #ff9eac !important; }
.signal-candidate-details { margin-top: 7px; color: #7d8da2; font: 8px var(--mono); }
.signal-candidate-details summary { width: fit-content; padding: 5px 0 1px; color: #8293a9; cursor: pointer; }
.signal-candidate-details summary:hover { color: #b7c7db; }
.signal-candidate-context-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 14px; padding: 9px 0 4px; }
.signal-candidate-context-grid > div { display: grid; gap: 4px; }
.signal-outcome-detail { margin: 4px 0 8px; color: #8b9aaf; line-height: 1.5; overflow-wrap: anywhere; }
.signal-candidate-id { color: #586a81; font-size: 7px; overflow-wrap: anywhere; }
.signal-audit-footer { display: flex; align-items: baseline; gap: 7px; padding: 10px 17px; border-top: 1px solid #1e293b; color: #94a3b8; background: #090e1a; font: 8px var(--mono); }
.signal-audit-footer strong { color: #22c55e; font-weight: 600; }
.model-console { display: grid; grid-template-rows: auto auto minmax(120px, 1fr) auto; max-height: calc(100vh - 28px); overflow: hidden; }
.terminal-titlebar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 17px; border-bottom: 1px solid #1e293b; background: #0c1527; }
.terminal-title-left, .terminal-title-right { display: flex; min-width: 0; align-items: center; gap: 13px; }
.terminal-title-left .eyebrow { margin: 0 0 4px; font-size: 8px; }
.terminal-title-left h2 { margin: 0; color: #dce6f0; font: 600 12px var(--mono); }
.terminal-lights { display: flex; flex: 0 0 auto; gap: 5px; }
.terminal-lights i { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; }
.terminal-lights i:nth-child(2) { background: #f59e0b; }
.terminal-lights i:nth-child(3) { background: #22c55e; }
.terminal-title-right { flex: 0 0 auto; gap: 10px; }
.terminal-title-right .subtle-label { font: 8px var(--mono); }
.terminal-context { display: flex; justify-content: space-between; gap: 12px; padding: 8px 17px; border-bottom: 1px solid #17243a; color: #74859b; background: #09111e; font: 8px var(--mono); }
.terminal-context span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.terminal-log-list { min-height: 0; max-height: min(68vh, 680px); overflow: auto; padding: 8px 17px; background: #060a14; scrollbar-color: #26354a transparent; scrollbar-width: thin; }
.terminal-log-empty { padding: 18px 2px; color: #38bdf8; font: 10px/1.6 var(--mono); }
.terminal-log-entry { min-width: 0; padding: 9px 0; border-bottom: 1px solid #17243a; }
.terminal-log-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.terminal-log-meta time, .terminal-log-model { color: var(--faint); font: 8px var(--mono); }
.terminal-log-model { overflow: hidden; margin-left: auto; text-overflow: ellipsis; white-space: nowrap; }
.terminal-log-message { margin: 6px 0 0; color: #c4cfdf; font: 9px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal-log-status { margin: 4px 0 0; color: #72839a; font: 8px/1.5 var(--mono); overflow-wrap: anywhere; }
.terminal-log-details { margin-top: 5px; color: #96a6b9; font: 8px var(--mono); }
.terminal-log-details summary { width: fit-content; padding: 3px 0; color: #8091a7; cursor: pointer; }
.terminal-log-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding: 7px 0 3px; }
.terminal-log-detail-grid > div > span { color: #72839a; font: 8px var(--mono); text-transform: uppercase; }
.terminal-log-detail-grid p, .terminal-log-detail-grid ul { margin: 5px 0 0; color: #aebaca; line-height: 1.5; overflow-wrap: anywhere; }
.terminal-log-detail-grid ul { padding-left: 16px; }
.terminal-log-detail-grid li + li { margin-top: 3px; }
.model-log-none { color: var(--faint) !important; }
.terminal-prompt { display: flex; align-items: baseline; gap: 7px; padding: 10px 17px; border-top: 1px solid #1e293b; color: #94a3b8; background: #090e1a; font: 9px var(--mono); }
.terminal-prompt strong { color: #22c55e; font-weight: 600; }
.trade-side { font: 700 8px var(--mono); }
.trade-side.buy { color: #8de6a8; }
.trade-side.sell { color: #ff9eac; }
.trade-row { cursor: pointer; transition: background .14s ease; }
.trade-row:hover { background: #111c2b; }
.trade-row.selected { background: #12271e; }
.trade-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.tp-cell { min-width: 82px; white-space: nowrap; }
.target-price { display: block; color: #cbd7e5; font: 8px var(--mono); }
.tp-badge { display: inline-flex; margin-top: 4px; padding: 2px 4px; border: 1px solid #344156; border-radius: 4px; color: #b8c4d3; background: #162235; font: 7px var(--mono); }
.tp-badge.hit { color: #a7f3bd; border-color: #24583a; background: #11271b; }
.tp-badge.pending { color: #9edcf7; border-color: #24516a; background: #112535; }
.tp-badge.missed { color: #ffb1bb; border-color: #64313b; background: #311a21; }
.tp-badge.stale { color: #9ca9b9; border-color: #3a4555; background: #17202e; }
.stop-price { color: #ff9eac !important; font-family: var(--mono); }
.trade-result.positive { color: #8de6a8; font: 9px var(--mono); }
.trade-result.negative { color: #ff9eac; font: 9px var(--mono); }
.trade-state.open { color: #9edcf7; border-color: #24516a; background: #112535; }
.trade-state.closed { color: #abb7c6; }
.table-actions { display: flex; align-items: center; gap: 13px; }
.signal-audit-open-button { min-height: 30px; padding: 0 8px; font-size: 8px; }
.activity-panel > .panel-heading .table-actions { flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.activity-panel .panel-heading { padding-bottom: 13px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; padding: 15px 3px 0; color: #5f6e82; font-size: 8px; }

.empty-state { display: grid; min-height: 175px; place-items: center; padding: 18px; color: var(--faint); font-size: 10px; text-align: center; }
.empty-state.compact { min-height: 85px; font-size: 9px; }
.toast-region { position: fixed; right: 22px; bottom: 19px; z-index: 20; display: grid; gap: 8px; }
.toast { max-width: min(380px, calc(100vw - 32px)); padding: 11px 14px; border: 1px solid #2b3a50; border-radius: 8px; color: #eaf1f8; background: #142033; box-shadow: 0 10px 30px #0008; font-size: 10px; animation: toast-in .2s ease-out; }
.toast.error { border-color: #703a44; color: #ffc4cb; background: #2b1a21; }
@keyframes toast-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.modal { width: min(440px, calc(100vw - 28px)); max-width: none; max-height: calc(100vh - 28px); padding: 0; overflow: auto; border: 1px solid #2a3a52; border-radius: 14px; color: var(--text); background: #0c1523; box-shadow: 0 24px 80px #000b; }
.modal::backdrop { background: #030710cf; backdrop-filter: blur(5px); }
.modal-card { padding: 27px; }
.modal-card-small { padding: 21px; }
.settings-modal { width: min(780px, calc(100vw - 28px)); }
.settings-content { display: grid; gap: 13px; padding: 23px; }
.settings-content > .modal-top { margin-bottom: 0; }
.settings-content > .modal-copy { margin: 0; }
.settings-section { display: grid; gap: 13px; margin: 0; padding: 15px; border: 1px solid #26354a; border-radius: 10px; background: #0a1220; }
.settings-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-section-heading .eyebrow { margin: 0 0 4px; }
.settings-section-heading h3 { margin: 0; color: #edf4fc; font-size: 13px; }
.settings-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.settings-field { display: grid; align-content: start; gap: 6px; color: #acb9c9; font-size: 9px; font-weight: 700; }
.settings-field .form-input { min-width: 0; }
.settings-field[hidden] { display: none; }
.settings-model-input { display: flex; gap: 7px; min-width: 0; }
.settings-model-input .form-input { flex: 1; }
.settings-model-input .button { flex: 0 0 auto; min-height: 39px; padding: 0 10px; font-size: 9px; }
.timeframe-settings { min-width: 0; margin: 0; padding: 12px; border: 1px solid #25354a; border-radius: 8px; }
.timeframe-settings legend { padding: 0 5px; color: #d8e3ef; font-size: 9px; font-weight: 750; }
.timeframe-settings > p { margin: 0 0 10px; color: var(--muted); font-size: 9px; }
.timeframe-setting-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.timeframe-option { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 1px solid #2a3b52; border-radius: 7px; color: #cad5e3; background: #101b2a; font-size: 10px; font-weight: 750; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.timeframe-option:has(input:checked) { border-color: #28774a; color: #7af0a6; background: #10291d; }
.timeframe-option input { accent-color: #22c55e; }
.settings-option-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid #25354a; border-radius: 8px; background: #101b2a; }
.settings-option-row > div { display: grid; gap: 4px; }
.settings-option-row strong { color: #dce6f1; font-size: 9px; }
.settings-option-row small { color: var(--muted); font-size: 8px; line-height: 1.5; }
.settings-option-row .toggle-row { flex: 0 0 auto; }
.settings-option-row .toggle-ui { display: block; }
.settings-save-error { min-height: 0; margin: -5px 0 0; }
.settings-save-error:empty, #entry-timeframes-error:empty { display: none; }
.settings-save-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-save-status { color: #8191a7; font-size: 8px; }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.settings-section-copy { margin: -6px 0 0; }
.settings-market-note { margin: 4px 0 0; color: var(--faint); font-size: 8px; line-height: 1.45; }
.settings-content .security-note { margin: 0; }
.auth-card { padding: 14px; border: 1px solid #26354a; border-radius: 9px; background: #101b2b; }
.auth-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.auth-card-heading .eyebrow { margin: 0 0 4px; }
.auth-card-heading h3 { margin: 0; color: #edf4fc; font-size: 13px; }
.auth-state { padding: 5px 8px; border: 1px solid #35445b; border-radius: 99px; color: #aab8ca; font-size: 8px; font-weight: 750; white-space: nowrap; }
.auth-state.authenticated { border-color: #236c47; color: #61e89b; background: #123425; }
.auth-state.waitingforbrowser, .auth-state.waitingforcode, .auth-state.waitingforterminal, .auth-state.starting { border-color: #775f2d; color: #ffc55c; background: #302717; }
.auth-state.failed { border-color: #703a44; color: #ff9aa7; background: #2b1a21; }
.auth-message { margin: 9px 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.auth-link { display: inline-block; margin: 0 0 8px; color: #63dda0; font-size: 9px; font-weight: 700; }
.auth-code { margin: 0 0 9px; color: #73efaa; font-family: Consolas, monospace; font-size: 14px; font-weight: 800; letter-spacing: .08em; }
.auth-actions { display: flex; gap: 7px; }
.auth-actions .button { min-height: 32px; padding: 0 11px; font-size: 9px; }
.auth-code-form { margin: 8px 0 11px; }
.auth-code-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.auth-code-entry .button { min-height: 38px; }
.auth-code-form[hidden] { display: none; }
.modal-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 27px; color: #cfdae7; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.modal-card h2 { margin: 0; font-size: 21px; letter-spacing: -.04em; }
.modal-copy { margin: 9px 0 19px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.form-label { display: block; margin: 12px 0 6px; color: #acb9c9; font-size: 9px; font-weight: 700; }
.form-input { width: 100%; min-height: 39px; padding: 0 11px; border: 1px solid #2b3b52; border-radius: 7px; outline: 0; color: #eef4fb; background: #08111e; font-size: 10px; }
.form-input:focus { border-color: #35824f; box-shadow: 0 0 0 3px #22c55e1c; }
select.form-input { color-scheme: dark; }
.form-error { min-height: 14px; margin: 9px 0 4px; color: #fb9ba7; font-size: 9px; }
.full-button { width: 100%; min-height: 40px; }
.security-note { display: flex; align-items: center; gap: 7px; margin: 15px 0 0; color: #75849a; font-size: 8px; line-height: 1.5; }
.security-dot { flex: 0 0 6px; width: 6px; height: 6px; background: var(--green); }
.modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-top h2 { font-size: 17px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.small-copy { margin-bottom: 12px; font-size: 9px; }

@media (min-width: 1550px) {
  .market-workspace { grid-template-columns: minmax(0, 1.8fr) minmax(275px, .8fr); }
  .chart-wrap { height: 290px; }
}
@media (max-width: 1180px) {
  .page-content { padding-right: 23px; padding-left: 23px; }
  .indicator-lab-grid { grid-template-columns: minmax(0, 1fr); }
  .indicator-tools-column { grid-template-rows: auto auto; }
  .indicator-assistant-panel { min-height: 470px; }
  .indicator-ai-conversation { min-height: 180px; max-height: 360px; }
  .terminal-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .market-workspace { grid-template-columns: minmax(0, 1fr); }
  .chart-panel, .market-side, .conditions-card, .models-panel, .activity-panel { grid-column: 1; grid-row: auto; }
  .chart-wrap { height: 280px; }
}
@media (max-width: 800px) {
  .rail { width: 55px; }
  .workspace { margin-left: 55px; }
  .topbar { height: 56px; padding: 0 16px; }
  .topbar-brand { gap: 8px; font-size: 9px; }
  .topbar-clock { display: none; }
  .page-content { padding: 23px 15px 18px; }
  .models-panel > .panel-heading { align-items: flex-start; }
  .models-panel > .panel-heading .table-actions { justify-content: flex-start; }
  .activity-panel > .panel-heading { align-items: flex-start; }
  .activity-panel > .panel-heading .table-actions { justify-content: flex-start; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { min-height: 99px; padding: 12px; }
  .terminal-layout { grid-template-columns: minmax(0, 1fr); }
  .watchlist-panel { position: static; }
  .pair-list { display: grid; grid-auto-columns: minmax(180px, 1fr); grid-auto-flow: column; max-height: none; min-height: 0; overflow-x: auto; padding-bottom: 10px; }
  .pair-row { min-width: 180px; }
  .watchlist-footer { display: none; }
  .indicator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicator:not(:nth-child(2n)) { border-right: 1px solid var(--border-soft); }
  .indicator:nth-child(2n) { border-right: 0; padding-right: 4px; padding-left: 14px; }
  .indicator:nth-child(2n + 1) { padding-left: 4px; }
  .chart-wrap { height: 250px; }
  .timeframe-plan-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .indicator-editor-body { padding-right: 11px; padding-left: 11px; }
  .indicator-code-editor { min-height: 230px; font-size: 10px; }
  .indicator-ai-form { gap: 9px; padding-right: 11px; padding-left: 11px; }
  .indicator-ai-select-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .indicator-ai-conversation { min-height: 150px; }
  .indicator-ai-message { max-width: 100%; }
  .indicator-ai-actions { align-items: stretch; flex-direction: column; }
  .indicator-ai-actions .button { width: 100%; }
  .indicator-catalog-content { gap: 8px; max-height: calc(100vh - 18px); padding: 13px; }
  .catalog-dialog-list { max-height: 68vh; }
  .indicator-compile-row { align-items: flex-start; flex-direction: column; }
  .indicator-compile-row > div { width: 100%; }
  .indicator-compile-row .button { flex: 1; }
  .indicator-definition-list { max-height: 390px; }
  .pair-indicators-content { grid-template-rows: auto auto minmax(90px, 1fr) minmax(70px, auto); gap: 9px; max-height: calc(100vh - 18px); padding: 13px; }
  .pair-indicators-content .modal-top h2 { font-size: 14px; }
  .pair-indicator-list { max-height: 36vh; }
  .pair-indicator-values { max-height: 24vh; }
  .timeframe-plan-list { grid-template-columns: minmax(0, 1fr); }
  .settings-modal { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .settings-content { gap: 10px; padding: 15px; }
  .settings-section { gap: 10px; padding: 11px; }
  .settings-field-grid, .auth-grid { grid-template-columns: minmax(0, 1fr); }
  .timeframe-setting-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-model-input { align-items: stretch; }
  .settings-save-row { align-items: stretch; flex-direction: column; }
  .settings-save-row .button { width: 100%; }
  .rail { width: 46px; padding-top: 12px; }
  .brand-mark, .rail-link { width: 34px; height: 34px; }
  .brand-mark { margin-bottom: 27px; }
  .brand-glyph { width: 32px; height: 32px; font-size: 18px; }
  .brand-glyph.small { width: 24px; height: 24px; font-size: 13px; }
  .rail-nav, .rail-bottom { gap: 8px; }
  .avatar { width: 29px; height: 29px; }
  .workspace { margin-left: 46px; }
  .topbar { padding: 0 11px; }
  .topbar-section, .brand-divider { display: none; }
  .connection-status { gap: 6px; padding: 6px 8px; font-size: 8px; }
  .page-content { padding: 20px 10px 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 17px; }
  .page-subtitle { max-width: 270px; font-size: 10px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .stat-grid { gap: 7px; margin-bottom: 11px; }
  .stat-card { min-height: 91px; padding: 10px; }
  .stat-top { font-size: 8px; }
  .stat-icon { width: 22px; height: 22px; }
  .stat-card strong { font-size: 18px; }
  .terminal-layout, .market-workspace { gap: 10px; }
  .market-side { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .chart-heading { align-items: flex-start; flex-direction: column; gap: 11px; padding: 13px; }
  .price-block { display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .price-block strong { font-size: 16px; }
  .chart-toolbar { align-items: flex-start; flex-direction: column; padding: 0 11px 8px; }
  .chart-legend { display: none; }
  .timeframes { gap: 1px; }
  .timeframe { min-width: 31px; }
  .chart-wrap { height: 218px; padding-right: 3px; padding-left: 3px; }
  .chart-zoom-controls { top: 7px; right: 7px; }
  .quote-strip > div { padding: 8px 7px; }
  .quote-strip span { font-size: 7px; }
  .quote-strip strong { font-size: 8px; }
  .panel-heading { padding: 13px 12px 11px; }
  #activity th, .models-panel th { padding: 8px 9px; }
  #activity td, .models-panel td { padding: 8px 9px; }
  .page-footer { flex-direction: column; }
  .modal-card { padding: 21px; }
  .model-console-modal { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .model-console { max-height: calc(100vh - 16px); }
  .signal-audit-modal { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .signal-audit-shell { max-height: calc(100vh - 16px); }
  .signal-audit-context { align-items: flex-start; flex-direction: column; gap: 4px; padding: 7px 11px; }
  .signal-audit-context span:last-child { text-align: left; }
  .signal-audit-toolbar { align-items: stretch; flex-direction: column; gap: 9px; padding: 10px 11px 8px; }
  .signal-audit-toolbar .settings-field { width: 100%; }
  .signal-audit-summary { gap: 5px; padding: 0 11px 8px; }
  .signal-audit-stat { padding: 7px; }
  .signal-audit-list { padding: 1px 11px 8px; }
  .signal-candidate { padding: 9px; }
  .signal-candidate-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .signal-candidate-context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signal-audit-footer { padding: 9px 11px; }
  .terminal-titlebar { padding: 10px 11px; }
  .terminal-context { align-items: flex-start; flex-direction: column; gap: 4px; padding: 7px 11px; }
  .terminal-context span:last-child { max-width: 100%; text-align: left; }
  .terminal-log-list { padding-right: 11px; padding-left: 11px; }
  .terminal-log-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .terminal-prompt { padding-right: 11px; padding-left: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
