:root {
  --bg: #06132d;
  --card: #0b1d3e;
  --card2: #0a1732;
  --text: #edf5ff;
  --muted: #a9c1e8;
  --line: rgba(75, 165, 255, .22);
  --brand: #ffbf24;
  --brand2: #16c8ff;
  --good: #19e0a2;
  --warn: #ffc247;
  --bad: #ff5577;
  --chip: #0d2850;
  --shadow: 0 18px 48px rgba(0, 5, 20, .42);
  --radius: 17px;
}

body {
  background:
    radial-gradient(ellipse at 50% -18%, rgba(0, 143, 255, .25), transparent 48%),
    radial-gradient(ellipse at 8% 40%, rgba(0, 209, 255, .09), transparent 34%),
    radial-gradient(ellipse at 94% 72%, rgba(93, 71, 255, .12), transparent 34%),
    #050d20;
  color: var(--text);
}

.header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 90px;
  background:
    radial-gradient(ellipse at 51% 116%, rgba(0, 134, 255, .35), transparent 45%),
    linear-gradient(180deg, #07132e 0%, #06132d 63%, #081a38 100%);
  border-bottom: 1px solid rgba(35, 177, 255, .48);
  box-shadow: 0 8px 28px rgba(0, 116, 255, .13);
}

.header::before {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  left: 34%;
  right: 33%;
  inset-block: 0;
  opacity: .84;
  background: linear-gradient(180deg, rgba(14, 43, 101, .55), rgba(5, 20, 51, .97));
  clip-path: polygon(0 77%, 6% 66%, 12% 75%, 22% 32%, 37% 73%, 49% 52%, 59% 77%, 73% 27%, 87% 70%, 94% 56%, 100% 69%, 100% 100%, 0 100%);
  filter: drop-shadow(0 -2px 8px rgba(0, 106, 255, .32));
}

.header::after {
  display: none;
}

.header-content {
  position: relative;
  z-index: 1;
  padding: 8px clamp(16px, 1.6vw, 28px);
}

.header-content::before {
  display: none;
}

.header .topbar {
  position: relative;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .95fr) minmax(270px, .82fr);
  gap: 20px;
}

.header .brand {
  min-width: 0;
  gap: 14px;
}
.logo {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 0;
  filter: drop-shadow(0 2px 7px rgba(24, 196, 255, .28));
}
.header .title { min-width: 0; }
.title-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.title h1 {
  color: #f4f8ff;
  font-size: clamp(18px, 1.45vw, 24px);
  font-weight: 800;
  letter-spacing: .15px;
}
.header .title p { color: #b6c9e9; font-size: 13px; }
.header .sim-notice {
  flex: 0 0 auto;
  padding: 7px 12px;
  color: #ffd45c;
  background: rgba(255, 184, 23, .14);
  border-color: rgba(255, 190, 36, .58);
  box-shadow: 0 0 18px rgba(255, 174, 0, .1);
}
.header .sim-notice.active {
  color: #62f3b5;
  background: rgba(13, 207, 135, .13);
  border-color: rgba(37, 236, 165, .58);
}
.header .statusPill {
  width: 100%;
  min-height: 62px;
  justify-content: flex-start;
  border-radius: 22px;
  border-color: rgba(57, 162, 255, .32);
  background: rgba(7, 25, 58, .88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2), 0 0 20px rgba(0, 119, 255, .1);
}
.header .statusPill > div:last-child > div:first-child { font-size: 14px !important; }
.header .statusPill .statusText { color: #a9c3e9; }
.header-tools { min-width:0; display:flex; align-items:center; justify-content:flex-end; gap:8px; }
.header-tools #btnInjSettings { flex:0 0 auto; white-space:nowrap; }
.header-tools .statusPill {
  flex:0 1 176px;
  width:auto;
  min-width:0;
  min-height:46px;
  gap:7px;
  padding:6px 9px;
  border-radius:14px;
}
.header-tools .statusPill > div:last-child { min-width:0; overflow:hidden; }
.header-tools .statusPill > div:last-child > div:first-child {
  overflow:hidden;
  font-size:11px !important;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.header-tools .statusPill .statusText {
  overflow:hidden;
  font-size:10px;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.header .dot.warn {
  background: #ffbd20;
  box-shadow: 0 0 12px rgba(255, 189, 32, .65);
}
.market-scene {
  position: relative;
  align-self: stretch;
  min-width: 0;
  min-height: 72px;
  overflow: hidden;
}
.market-chart {
  position: absolute;
  inset: 5px 0 0;
  width: 100%;
  height: calc(100% - 5px);
  overflow: visible;
}
.chart-grid {
  fill: none;
  stroke: rgba(52, 131, 231, .19);
  stroke-width: 1;
  stroke-dasharray: 3 6;
}
.chart-fill { fill: rgba(0, 132, 255, .16); }
.chart-line {
  fill: none;
  stroke: #20baff;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(0, 160, 255, .85));
}
.market-coin {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, .65);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45), inset 0 0 9px rgba(255, 255, 255, .2);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}
.coin-btc {
  top: 3px;
  left: 10%;
  color: #fff7df;
  background: linear-gradient(145deg, #ffd454, #e78904);
  box-shadow: 0 0 16px rgba(255, 180, 26, .55), inset 0 0 9px rgba(255, 255, 255, .3);
}
.coin-eth {
  right: 7%;
  bottom: 2px;
  width: 36px;
  height: 36px;
  padding: 8px 10px;
  color: #eaf4ff;
  background: linear-gradient(145deg, #63a5ff, #314eb7);
  box-shadow: 0 0 16px rgba(42, 121, 255, .5), inset 0 0 9px rgba(255, 255, 255, .23);
}
.coin-eth svg { width: 15px; height: 21px; }
.coin-usdt {
  top: 28px;
  left: 32%;
  width: 29px;
  height: 29px;
  color: #e8fff7;
  background: linear-gradient(145deg, #36d7ad, #008e78);
  font-size: 19px;
}
.coin-sol {
  top: 2px;
  right: 31%;
  width: 31px;
  height: 31px;
  gap: 2px;
  padding: 7px 6px;
  border: 0;
  border-radius: 9px;
  background: rgba(11, 22, 48, .9);
  transform: rotate(-12deg);
}
.coin-sol i {
  width: 17px;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, #21e4ba, #ae7aff);
  transform: skewX(-25deg);
}
.coin-super {
  right: 22%;
  bottom: 0;
  width: 28px;
  height: 28px;
  color: #fff;
  border-color: rgba(197, 144, 255, .92);
  background: linear-gradient(145deg, #ba55ff, #5e28cb);
  font-size: 15px;
  font-style: italic;
  box-shadow: 0 0 15px rgba(154, 79, 255, .5), inset 0 0 8px rgba(255, 255, 255, .24);
}
.coin-super span { margin-left: -3px; font-size: 9px; }

.page { padding: 12px clamp(12px, 1vw, 18px) 48px; }
.grid {
  gap: 14px;
  grid-template-columns: minmax(330px, .96fr) minmax(540px, 2fr) minmax(330px, .96fr);
  grid-template-areas: "connection center performance";
  align-items: stretch;
}
#leftPanel { grid-area: connection; }
.rightTop { grid-area: center; }
.sideTop { grid-area: performance; }
#leftPanel {
  display: flex;
  flex-direction: column;
  height: clamp(360px, calc(100vh - 112px), 850px);
  min-height: 0;
}
#leftPanel > .cardHeader { flex: 0 0 auto; }
#leftPanel > .cardBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(29, 157, 255, .65) rgba(5, 19, 43, .8);
}
#leftPanel > .cardBody > .card { min-height: min-content; }
.grid > *,
.split > * { min-width: 0; }
#leftPanel,
#rightPanel,
#statsPanel > .card {
  border-color: rgba(55, 157, 255, .31);
  background: linear-gradient(155deg, rgba(11, 35, 74, .98), rgba(5, 16, 39, .98));
  box-shadow: 0 14px 38px rgba(0, 5, 22, .34), inset 0 1px rgba(126, 202, 255, .07);
}
.cardHeader {
  padding: 14px 15px 12px;
  border-bottom-color: rgba(58, 155, 255, .2);
  background: linear-gradient(100deg, rgba(13, 50, 100, .58), rgba(7, 24, 55, .5));
}
.cardHeader h2 { color: #eef6ff; font-size: 14px; }
.cardHeader .sub { color: #9cb9e4; }
.cardBody { padding: 13px 14px 15px; }
.panelTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.panelTitle h2 { margin: 0; }
.panelIcon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(72, 170, 255, .62);
  border-radius: 12px;
  color: #b9e7ff;
  background: linear-gradient(145deg, rgba(33, 111, 255, .65), rgba(73, 48, 213, .72));
  box-shadow: 0 0 18px rgba(30, 130, 255, .24), inset 0 0 12px rgba(255, 255, 255, .08);
}
.panelIcon svg,
.fieldLabelIcon svg,
.inputIcon svg,
.robotControlIcon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.panelIcon-settings {
  color: #e7c8ff;
  border-color: rgba(182, 106, 255, .64);
  background: linear-gradient(145deg, rgba(148, 65, 238, .72), rgba(76, 49, 194, .78));
  box-shadow: 0 0 18px rgba(148, 65, 238, .25), inset 0 0 12px rgba(255, 255, 255, .08);
}
.fieldLabelIcon {
  width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  margin-right: 7px;
  vertical-align: middle;
  color: #4bd9ff;
}
.fieldLabelIcon svg { width: 19px; height: 19px; }
.icon-mode { color: #bd8aff; }
.icon-coin { color: #62d7ff; }
.icon-target { color: #ffd44b; }
.inputIconWrap,
.selectIconWrap {
  position: relative;
  min-width: 0;
}
.inputIcon {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  display: grid;
  place-items: center;
  width: 48px;
  color: #75ceff;
  pointer-events: none;
}
.inputIcon svg { width: 21px; height: 21px; }
.inputIcon-key { color: #89c9ff; }
.inputIcon-secret { color: #b8c8e4; }
.inputIcon-server { color: #63c9ff; }
.inputIcon-mode { color: #c598ff; }
.inputIcon-coin { color: #56dbff; }
.inputIcon-target { color: #ffd34d; }
.inputIconWrap input,
.selectIconWrap select {
  width: 100%;
  padding-left: 48px;
}
.robotControlIcon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(35, 221, 255, .6);
  border-radius: 9px;
  color: #83f3ff;
  background: linear-gradient(145deg, rgba(0, 164, 211, .58), rgba(12, 69, 153, .68));
  box-shadow: 0 0 14px rgba(0, 196, 255, .2);
}
.robotControlIcon svg { width: 21px; height: 21px; }
.botHeaderPill {
  border-color: rgba(52, 148, 255, .22);
  background: rgba(13, 40, 80, .7);
}

input,
select,
textarea {
  color: #f0f7ff;
  border-color: rgba(65, 151, 238, .33);
  background: rgba(5, 19, 44, .88);
}
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(21, 202, 255, .82);
  box-shadow: 0 0 0 3px rgba(10, 177, 255, .15), 0 0 18px rgba(0, 169, 255, .1);
}
label { color: #adc8ed; }
.hint {
  border-color: rgba(255, 190, 36, .25);
  background: rgba(255, 181, 20, .065);
  color: #b9cce7;
}
.chip {
  color: #dcecff;
  background: rgba(10, 42, 83, .84);
  border-color: rgba(55, 151, 255, .22);
}
.chip b { color: #ffd051; }

button {
  border-color: rgba(68, 160, 255, .33);
  background: linear-gradient(145deg, rgba(15, 56, 108, .92), rgba(8, 33, 72, .95));
  color: #eaf5ff;
  box-shadow: 0 5px 14px rgba(0, 5, 25, .22);
}
button:hover {
  border-color: rgba(66, 199, 255, .68);
  background: linear-gradient(145deg, rgba(18, 83, 146, .96), rgba(8, 45, 92, .96));
  box-shadow: 0 7px 20px rgba(0, 122, 255, .17);
}
button.primary {
  color: #171400;
  background: linear-gradient(135deg, #ffd94e, #ffad16);
  border-color: #ffe27a;
  box-shadow: 0 5px 18px rgba(255, 173, 13, .23), inset 0 1px rgba(255, 255, 255, .5);
}
button.primary:hover { background: linear-gradient(135deg, #ffe56c, #ffbb29); }
button.ghost {
  background: linear-gradient(145deg, rgba(18, 67, 129, .76), rgba(8, 36, 80, .86));
}
button.dangerSoft {
  color: #ffd9e1;
  background: linear-gradient(135deg, rgba(145, 25, 56, .8), rgba(78, 15, 39, .92));
  border-color: rgba(255, 82, 119, .52);
}
button.dangerSoft:hover {
  background: linear-gradient(135deg, rgba(193, 32, 71, .92), rgba(105, 18, 47, .96));
}
.tradeCtrlSeg {
  background: rgba(3, 17, 40, .72);
  border-color: rgba(63, 158, 255, .23);
}
.tradeCtrlSeg .tradeStart {
  color: #caffeb;
  background: linear-gradient(135deg, rgba(10, 157, 119, .55), rgba(5, 74, 88, .76));
  border-color: rgba(30, 231, 170, .59);
}
.tradeCtrlSeg .tradePause {
  color: #ffedb5;
  background: linear-gradient(135deg, rgba(176, 111, 9, .54), rgba(91, 63, 12, .78));
  border-color: rgba(255, 195, 49, .55);
}
.tradeCtrlSeg .tradeStop {
  color: #ffd1dc;
  background: linear-gradient(135deg, rgba(160, 30, 64, .54), rgba(79, 17, 42, .78));
  border-color: rgba(255, 82, 119, .5);
}
.tradeCtrlSeg .tradeStart.isActive {
  background: linear-gradient(135deg, #15dda0, #05a9ab);
  border-color: #67ffd1;
}
.tradeCtrlSeg .tradePause.isActive {
  background: linear-gradient(135deg, #ffd445, #ffa51b);
  border-color: #ffe779;
}
.tradeCtrlSeg .tradeStop.isActive {
  background: linear-gradient(135deg, #ff6482, #df315b);
  border-color: #ff9ab0;
}

.rightTop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 300px minmax(0, 1fr);
  align-content: stretch;
  align-items: stretch;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.rightTop > #rightPanel {
  grid-column: 1 / -1;
  height: auto !important;
  max-height: none !important;
  min-height: 0;
}
.rightTop .cardBody {
  gap: 12px;
  min-height: 0;
}
.rightTop > #rightPanel > .cardBody {
  overflow: auto;
  scrollbar-color: rgba(29, 157, 255, .65) rgba(5, 19, 43, .8);
}
.middleLowerGrid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  min-height: 0;
}
.middleToolCard {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
}
.middleToolCard > .cardHeader { flex: 0 0 auto; }
.middleToolCard > .cardBody {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.middleToolCard .log,
.middleToolCard .aiBox {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(29, 157, 255, .65) rgba(5, 19, 43, .8);
}
.panelIcon-log {
  color: #a7f0ff;
  border-color: rgba(20, 202, 255, .68);
  background: linear-gradient(145deg, rgba(8, 184, 224, .76), rgba(18, 77, 220, .86));
}
.panelIcon-chat {
  color: #aaffee;
  border-color: rgba(19, 221, 188, .64);
  background: linear-gradient(145deg, rgba(11, 197, 164, .76), rgba(5, 121, 144, .86));
}
.panelIcon-performance {
  color: #a8ffe3;
  border-color: rgba(38, 231, 173, .68);
  background: linear-gradient(145deg, rgba(13, 207, 151, .74), rgba(0, 119, 134, .84));
  box-shadow: 0 0 18px rgba(20, 222, 164, .24), inset 0 0 12px rgba(255, 255, 255, .08);
}
.performanceSectionTitle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: rgba(233, 236, 255, .9);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .3px;
}
.performanceSectionTitle .panelIcon {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 10px;
}
.panelIcon-profit {
  color: #aaffdf;
  border-color: rgba(31, 225, 165, .66);
  background: linear-gradient(145deg, rgba(10, 200, 149, .7), rgba(0, 101, 131, .82));
}
#statsPanel .accountMetrics > .metric,
#statsPanel .performanceMetrics > .metric {
  position: relative;
  min-width: 0;
  padding-left: 48px;
}
#statsPanel .statsMetricIcon {
  position: absolute;
  top: 12px;
  left: 11px;
  width: 28px;
  height: 28px;
  overflow: visible;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .35));
}
#statsPanel .statsMetricIcon.icon-gold { filter: drop-shadow(0 0 5px rgba(255, 195, 51, .42)); }
#statsPanel .statsMetricIcon.icon-pink { filter: drop-shadow(0 0 5px rgba(245, 78, 226, .4)); }
#statsPanel .statsMetricIcon.icon-green { filter: drop-shadow(0 0 5px rgba(27, 235, 171, .4)); }
#statsPanel .statsMetricIcon.icon-yellow { filter: drop-shadow(0 0 5px rgba(255, 204, 56, .4)); }
#statsPanel .statsMetricIcon.icon-purple { filter: drop-shadow(0 0 5px rgba(182, 94, 255, .42)); }
#statsPanel .statsMetricIcon.icon-cyan { filter: drop-shadow(0 0 5px rgba(42, 207, 255, .42)); }
#statsPanel .statsMetricIcon.icon-blue { filter: drop-shadow(0 0 5px rgba(45, 147, 255, .42)); }
.statsIconLibrary {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.aiStatusLabel {
  flex: 0 0 auto;
  color: #a9c7ef;
  font-size: 11px;
}
.metricsRow { gap: 10px; }
.metric {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-color: rgba(54, 151, 255, .23);
  background: linear-gradient(145deg, rgba(8, 34, 72, .95), rgba(5, 20, 48, .94));
}
.rightTop .metricsStack .metric {
  min-height: 76px;
  padding: 13px 12px 12px 58px;
}
.rightTop .metricsStack .metric .k,
.rightTop .metricsStack .metric .v {
  position: relative;
  z-index: 2;
}
.metricIcon {
  position: absolute;
  z-index: 2;
  top: 18px;
  left: 13px;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid currentColor;
  border-radius: 11px;
  box-shadow: 0 0 14px color-mix(in srgb, currentColor 35%, transparent), inset 0 0 10px rgba(255, 255, 255, .1);
}
.metricIcon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.metricIcon-btc {
  color: #ffd05a;
  background: linear-gradient(145deg, rgba(255, 179, 30, .38), rgba(204, 100, 6, .35));
}
.metricIcon-btc svg { width: 24px; height: 24px; }
.metricIcon-wallet {
  color: #19e2b3;
  background: linear-gradient(145deg, rgba(12, 206, 159, .35), rgba(0, 111, 126, .35));
}
.metricIcon-operation {
  color: #52c7ff;
  background: linear-gradient(145deg, rgba(28, 151, 255, .38), rgba(36, 82, 206, .36));
}
.metricIcon-result {
  color: #18e6ad;
  background: linear-gradient(145deg, rgba(10, 209, 153, .34), rgba(0, 105, 125, .36));
}
.metricIcon-costs {
  color: #ffd044;
  background: linear-gradient(145deg, rgba(255, 187, 28, .35), rgba(179, 90, 8, .35));
}
.metricIcon-injections {
  color: #ed72ff;
  background: linear-gradient(145deg, rgba(223, 64, 255, .36), rgba(104, 46, 214, .37));
}
.rightTop .metricsRowBottom .metric {
  box-sizing: border-box;
  width: 100%;
  height: 116px;
  min-height: 116px;
  padding: 12px 10px 37px 58px;
}
.rightTop .metricsRowBottom .metricIcon {
  top: 12px;
  left: 11px;
  width: 36px;
  height: 36px;
}
.rightTop .metricsRowBottom {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.rightTop .metricsRowBottom .metric .k {
  font-size: clamp(9px, .78vw, 11px);
  line-height: 1.2;
}
.rightTop .metricsRowBottom .metric .v {
  font-size: clamp(10px, .88vw, 13px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.rightTop .metricsRowBottom #mInj {
  font-size: clamp(9px, .76vw, 11px);
  line-height: 1.18;
}
.metricWave {
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  overflow: visible;
  pointer-events: none;
}
.metricWave .waveLine,
.metricWave .waveGlow {
  fill: none;
  stroke: var(--wave-color);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.metricWave .waveLine {
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px var(--wave-color));
}
.metricWave .waveGlow {
  stroke-width: 4.5;
  opacity: .72;
}
.wave-result { --wave-color: #14edb0; }
.wave-costs { --wave-color: #ffc348; }
.wave-injections { --wave-color: #bf5dff; }
.metric .k { color: #a9c7ef; }
.metric .v { color: #f0f7ff; }
.metric .v.good { color: #26efae; }
.metric .v.bad { color: #ff6686; }
.segmented button.active {
  color: #e8f6ff;
  background: rgba(0, 160, 255, .29);
  border-color: rgba(55, 196, 255, .7);
  box-shadow: 0 0 16px rgba(0, 156, 255, .14);
}

.split { grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr); gap: 12px; }
.log,
.aiBox {
  position: relative;
  isolation: isolate;
  min-height: 300px;
  border-color: rgba(55, 155, 255, .35);
  background-color: #06142e;
  box-shadow: inset 0 0 30px rgba(0, 6, 26, .2);
}
.log {
  background-image:
    linear-gradient(180deg, rgba(4, 15, 35, .34), rgba(3, 12, 30, .16)),
    url("./bitacora.webp");
  background-position: center, center 58%;
  background-repeat: no-repeat;
  background-size: cover;
}
.aiBox {
  background-image:
    linear-gradient(180deg, rgba(4, 15, 35, .2), rgba(3, 12, 30, .18)),
    url("./robocito-dechat.webp");
  background-position: center, 55% center;
  background-repeat: no-repeat;
  background-size: cover;
}
.logLine,
.aiMsg {
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
}
.logLine {
  padding: 5px 7px;
  border-radius: 8px;
  background: rgba(2, 13, 33, .58);
  width: fit-content;
  max-width: 100%;
}
.aiMsg {
  border-color: rgba(52, 174, 255, .34);
  background: rgba(5, 23, 53, .86);
  backdrop-filter: blur(2px);
}
.aiMsg.ai { background: rgba(5, 23, 53, .86); }
.aiMsg.user { background: rgba(5, 77, 119, .88); }
.aiMsg .t { color: #77d9ff; }
.aiComposer textarea { background: rgba(5, 19, 44, .93); }

.sideTop .cardBody {
  overflow-x: hidden;
  scrollbar-color: rgba(28, 163, 255, .62) rgba(6, 20, 45, .72);
}
.footer {
  color: #8fabd2;
  border-top-color: rgba(58, 156, 255, .22);
}

@media (max-width: 1390px) and (min-width: 1181px) {
  .page { padding-inline: 12px; }
  .grid { grid-template-columns: minmax(285px, .92fr) minmax(440px, 1.7fr) minmax(285px, .92fr); gap: 11px; }
  .cardBody { padding-inline: 11px; }
  .cardHeader { padding-inline: 12px; }
  .cardHeaderActions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .cardHeaderActions button { padding: 7px 8px; }
  .metricsRow { gap: 7px; }
  .metric { padding: 10px; }
}

@media (max-width: 1390px) {
  html { height: auto; overflow-y: auto; }
  body { height: auto; min-height: 100vh; overflow-y: auto; }
  .page { flex: 0 0 auto; min-height: 0; }
  .grid { height: auto; min-height: 0; align-items: start; }
  #leftPanel {
    height: auto;
    max-height: none;
    min-height: 0;
  }
  #leftPanel > .cardBody {
    flex: initial;
    min-height: 0;
    overflow: visible;
  }
  #rightPanel,
  #statsPanel,
  #statsPanel > .card {
    height: auto;
    max-height: none;
  }
  #rightPanel > .cardBody,
  .sideTop .cardBody {
    flex: initial;
    min-height: 0;
    overflow: visible;
  }
}

@media (max-width: 1390px) and (min-width: 1181px) {
  .grid { align-items: stretch; }
  #leftPanel {
    height: clamp(520px, calc(100vh - 150px), 850px);
    max-height: 850px;
  }
  .rightTop { height: 100%; }
  #statsPanel > .card { height: 100%; }
  #statsPanel .cardBody {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
}

@media (max-width: 1180px) and (min-width: 821px) {
  .page { padding: 14px 16px 36px; }
  .grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "connection" "center" "performance";
  }
  #leftPanel { grid-row: auto; height: clamp(440px, calc(100vh - 170px), 780px); }
  .rightTop { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; }
  .sideTop,
  .sideTop > .card { height: auto; }
  .rightTop > #rightPanel,
  .middleLowerGrid { grid-column: 1; }
  .middleLowerGrid { grid-template-columns: minmax(0, 1fr); }
  .rightTop { grid-template-rows: 300px clamp(360px, 48vh, 480px); }
  .rightTop > .middleLowerGrid > .middleToolCard {
    height: clamp(360px, 48vh, 480px);
    max-height: 480px;
  }
  .log, .aiBox { min-height: 0; }
}

@media (max-width: 820px) {
  .header-content { padding: 9px 14px; }
  .header::before { left: 30%; right: 28%; opacity: .55; }
  .header .topbar { grid-template-columns: minmax(0, 1fr) 250px; }
  .header .brand { grid-column: 1; grid-row: 1; }
  .header-tools { grid-column: 2; grid-row: 1; flex-direction:row; align-items:center; justify-content:flex-end; gap:6px; }
  .header-tools .statusPill { flex-basis:150px; min-height:42px; padding:5px 7px; }
  .market-scene { grid-column: 1 / -1; grid-row: 2; min-height: 56px; }
  #leftPanel { height: clamp(440px, calc(100vh - 170px), 780px); }
  .header .logo { width: 60px; height: 60px; flex-basis: 60px; }
  .header .title h1 { font-size: 19px; }
  .header .title p { font-size: 11px; }
  .header .statusPill { min-height: 54px; padding: 8px 10px; }
  .header-tools .statusPill { min-height:42px; padding:5px 7px; }
  .page { padding: 12px 12px 28px; }
  .grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "connection" "center" "performance";
    gap: 12px;
  }
  #leftPanel { grid-row: auto; }
  .rightTop,
  .sideTop,
  .rightTop .card,
  .sideTop .card { height: auto; }
  .rightTop .cardBody { min-height: 0; }
  .rightTop { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; height: auto; }
  .rightTop > #rightPanel,
  .middleLowerGrid { grid-column: 1; }
  .middleLowerGrid { grid-template-columns: minmax(0, 1fr); }
  .rightTop { grid-template-rows: 300px clamp(340px, 50vh, 460px); }
  .rightTop > .middleLowerGrid > .middleToolCard {
    height: clamp(340px, 50vh, 460px);
    max-height: 460px;
  }
  .log, .aiBox { min-height: 260px; }
}

@media (max-width: 560px) {
  .header-content { padding: 9px 12px; }
  .header { min-height: 0; }
  .header::before { inset: auto 22% 0; height: 66%; opacity: .42; }
  .header .topbar { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .header .brand { grid-column: 1; grid-row: 1; gap: 10px; }
  .market-scene { grid-column: 1; grid-row: 2; min-height: 48px; }
  .header-tools { grid-column: 1; grid-row: 3; align-items:center; }
  .header .logo { width: 52px; height: 52px; flex-basis: 52px; }
  .header .title h1 { font-size: 17px; }
  .header .title p { font-size: 10px; line-height: 1.35; }
  .title-heading { gap: 8px; }
  .header .sim-notice { padding: 5px 9px; font-size: 10px; }
  .header-tools .statusPill { flex:0 1 176px; min-height:0; width:auto; margin-left:0; padding:6px 8px; }
  .header-tools #btnInjSettings { padding:8px 9px; }
  .page { padding-inline: 9px; }
  #leftPanel { height: auto; max-height: none; }
  #leftPanel > .cardBody { flex: initial; overflow: visible; }
  .card { border-radius: 14px; }
  .cardHeader { align-items: flex-start; flex-wrap: wrap; gap: 8px; padding: 12px 11px 10px; }
  .cardHeader .sub { font-size: 11px; }
  .cardBody { padding: 11px; }
  .cardHeaderActions { width: 100%; flex-wrap: wrap; gap: 6px; }
  .cardHeaderActions button { flex: 1 1 auto; padding: 8px 9px; }
  .botHeaderPills { flex-direction: row; align-items: center; }
  .botHeaderPill { padding: 6px 7px; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .tradeCtrlHeader { align-items: flex-start; flex-direction: column; }
  .tradeCtrlHint { text-align: left; }
  .tradeCtrlSeg { padding: 7px; gap: 6px; }
  .tradeCtrlSeg button { min-width: 0; padding: 10px 5px; font-size: 11px; gap: 4px; }
  .btnRow > button { flex: 1 1 135px; }
  .metricsRowTop,
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rightTop .metricsRowBottom { grid-template-columns: minmax(0, 1fr); }
  .metricsRow > .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .metric { padding: 9px; border-radius: 12px; }
  .metric .v { font-size: 13px; }
  .log, .aiBox { min-height: 240px; }
  .aiComposer { flex-direction: column; }
  .aiComposer textarea { min-height: 46px; width: 100%; }
  .aiComposer button { width: 100%; }
  .segmented { flex-wrap: wrap; }
}

@media (max-width: 370px) {
  .metricsRowTop,
  .metrics { grid-template-columns: minmax(0, 1fr); }
  .rightTop .metricsRowBottom { grid-template-columns: minmax(0, 1fr); }
  .metricsRow > .metric:last-child:nth-child(odd) { grid-column: auto; }
  .tradeCtrlSeg button { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .sim-notice.active { animation: none; }
  button { transition: none; }
}
