:root {
  --bg: #0b0c0f;
  --panel: #101216;
  --panel-2: #14171d;
  --panel-3: #191d24;
  --line: #232830;
  --line-2: #2b323c;
  --text: #c7cdd6;
  --text-2: #98a2b1;
  --mut: #74808f;
  --accent: #2fe0c8;
  --accent-2: #1a9e8d;
  --accent-soft: rgba(47, 224, 200, .12);
  --up: #2fbf8f;
  --down: #f0576b;
  --warn: #f0b34e;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text);
  background: radial-gradient(120% 90% at 50% -10%, #16191f 0%, #101216 42%, #0a0b0e 100%);
  font: 13px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, select, textarea { user-select: text; }
button, select, input { font-family: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg { display: block; }
::selection { background: rgba(47, 224, 200, .28); }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2a303a; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
#menubar {
  flex: none;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: linear-gradient(180deg, #1a1d23, #121419);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 4px 18px rgba(0, 0, 0, .3);
  position: relative;
  z-index: 60;
}
#brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 14px;
  color: #e8f7f4;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 3px;
}
#brand:hover { color: #fff; }
#brand span { transform: translateY(-.5px); }

#mainnav { display: flex; align-items: center; gap: 2px; }
.mtop {
  height: 28px;
  padding: 0 11px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: none;
  transition: background .15s, color .15s;
}
.mtop:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.mtop.on { background: rgba(47, 224, 200, .1); color: var(--accent); }
.caret {
  width: 0; height: 0;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: 0;
  opacity: .6;
  margin-top: 2px;
}

.spacer { flex: 1; }

#net {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(47, 224, 200, .06);
  border: 1px solid rgba(47, 224, 200, .16);
  font: 11px/1 var(--mono);
  color: #8ce9da;
}
#net .dot { width: 6px; height: 6px; border-radius: 50%; background: #2fe0c8; box-shadow: 0 0 8px #2fe0c8; }
#net.warn { background: rgba(240, 179, 78, .08); border-color: rgba(240, 179, 78, .2); color: #f0c37a; }
#net.warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.iconbtn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: #9aa4b2;
  transition: background .15s, color .15s;
}
.iconbtn:hover { background: rgba(255, 255, 255, .07); color: #fff; }

#acctBtn {
  position: relative;
  width: 28px; height: 28px;
  margin-left: 4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1c3b38, #12211f);
  border: 1px solid rgba(47, 224, 200, .45);
  color: #a9f4e8;
  font: 600 12px/1 var(--mono);
  display: grid;
  place-items: center;
}
#acctBtn .status {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--up);
  border: 2px solid #121419;
}
#acctBtn.warn { border-color: rgba(240, 179, 78, .6); color: #f4d29a; }
#acctBtn.warn .status { background: var(--warn); }

/* ---------- shell ---------- */
#shell { flex: 1; display: flex; min-height: 0; position: relative; }

/* ---------- rail ---------- */
#rail {
  flex: none;
  width: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .012);
}
.railbtn {
  width: 34px; height: 34px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #78828f;
  transition: background .15s, color .15s;
}
.railbtn:hover { background: rgba(255, 255, 255, .06); color: #dfe6ee; }
.railbtn.active { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(47, 224, 200, .2); }

/* ---------- work ---------- */
#work { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

#tabs {
  flex: none;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: #0e1014;
  overflow: hidden;
}
.tab {
  height: 25px;
  padding: 0 10px;
  border-radius: 5px;
  color: #8d97a4;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tab:hover { background: rgba(255, 255, 255, .05); color: #d7dee7; }
.tab.active { background: var(--panel-3); color: #eaf1f8; box-shadow: inset 0 0 0 1px var(--line-2); }
.tab-add {
  width: 24px; height: 24px;
  border-radius: 5px;
  color: #7c8694;
  font-size: 15px;
}
.tab-add:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 2px;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--line);
  color: #94a0af;
  font: 11px/1 var(--mono);
}
.ws-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.ws-badge.replay { color: #f0c37a; border-color: rgba(240, 179, 78, .3); background: rgba(240, 179, 78, .08); }

/* ---------- panel ---------- */
#panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 6px 6px 0;
  border: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
#panel:fullscreen { margin: 0; border-radius: 0; border: 0; }
#panel.min { flex: 1; }
#panel.min #chartArea, #panel.min #cvdArea { display: none; }

#panelbar {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #161920, #12151a);
  overflow: hidden;
}
.drag { color: #4b5562; font-size: 15px; letter-spacing: 1px; cursor: grab; padding: 0 2px; }

.tfwrap { display: flex; align-items: center; gap: 6px; }
.sel {
  height: 26px;
  padding: 0 22px 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: #12151a url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%23818d9c' stroke-width='1.3'/></svg>") no-repeat right 8px center;
  appearance: none;
  font: 600 12px/1 var(--mono);
  color: #dfe6ee;
  outline: none;
}
.sel:hover { border-color: #38414e; }
#symSel { width: 74px; }
#kindSel { width: 82px; font-weight: 500; font-family: var(--sans); }

.tfbtns { display: flex; padding: 2px; gap: 1px; border: 1px solid var(--line-2); border-radius: 5px; background: #0f1216; }
.tfbtns button {
  height: 20px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 3px;
  color: #828d9b;
  font: 11px/1 var(--mono);
}
.tfbtns button:hover { color: #e6edf5; background: rgba(255, 255, 255, .05); }
.tfbtns button.active { background: rgba(47, 224, 200, .14); color: #7df0df; }

.tb {
  height: 26px;
  padding: 0 9px;
  border-radius: 5px;
  color: #9aa5b3;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.tb:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.tb b { font-family: var(--mono); font-weight: 500; font-size: 12px; }
.tb sub { font-size: 8px; }

.tools { display: flex; align-items: center; gap: 1px; }
.tool {
  width: 27px; height: 27px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: #8b96a4;
  font: 12px/1 var(--mono);
}
.tool:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.tool.active { background: rgba(47, 224, 200, .14); color: #7df0df; }
.vsep { width: 1px; height: 18px; margin: 0 6px; background: var(--line-2); }
.panel-actions { display: flex; gap: 1px; margin-left: 6px; }
.pact {
  width: 24px; height: 24px;
  border-radius: 4px;
  color: #6f7a88;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.pact:hover { background: rgba(255, 255, 255, .07); color: #fff; }

.chart-stack { flex: 1; display: flex; flex-direction: column; min-height: 0; }

#chartArea { flex: 1; position: relative; min-height: 0; }
#cvdArea {
  flex: none;
  height: 132px;
  position: relative;
  border-top: 1px solid var(--line);
  background: #0e1115;
}
#chart, #cvd { width: 100%; height: 100%; display: block; cursor: crosshair; }
#cvdArea.hide { display: none; }

.pane-title {
  position: absolute;
  left: 10px;
  top: 6px;
  font: 11px/1 var(--mono);
  color: #8b96a4;
  letter-spacing: .2px;
  pointer-events: none;
}
.pane-val {
  position: absolute;
  left: 44px;
  top: 5px;
  font: 11px/1 var(--mono);
  color: #c7d2de;
  pointer-events: none;
}
.pane-val b { color: #7df0df; font-weight: 500; }

/* ---------- legend ---------- */
.legend {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 218px;
  padding: 8px 10px 6px;
  border-radius: 6px;
  background: rgba(10, 12, 16, .74);
  border: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(8px);
  z-index: 5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.legend.folded { width: 64px; padding: 6px 8px; }
.legend.folded label, .legend.folded #indClear { display: none; }
.lg-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  cursor: pointer;
  color: #b9c4d1;
  font: 10px/1 var(--mono);
  letter-spacing: .4px;
}
.lg-head b {
  display: grid;
  place-items: center;
  width: 18px; height: 16px;
  border-radius: 3px;
  background: rgba(47, 224, 200, .14);
  color: #7df0df;
  font-size: 9px;
}
.legend label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  color: #b3bdc9;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.legend label:hover { color: #fff; }
.legend input { position: absolute; opacity: 0; pointer-events: none; }
.legend .sw {
  width: 7px; height: 7px;
  border-radius: 2px;
  flex: none;
  opacity: .35;
  transition: opacity .15s, box-shadow .15s;
}
.legend input:checked + .sw { opacity: 1; box-shadow: 0 0 6px currentColor; }
.sw.gex { background: #36c9a8; color: #36c9a8; }
.sw.water { background: #9f7cff; color: #9f7cff; }
.sw.vwap { background: #f0a23c; color: #f0a23c; }
.sw.vol { background: #6d7c8f; color: #6d7c8f; }
.sw.cvd { background: #7df0df; color: #7df0df; }
.sw.fvg { background: #5a8cff; color: #5a8cff; }
.linkbtn {
  margin-top: 4px;
  padding: 2px 0;
  color: #7a8794;
  font-size: 10.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.linkbtn:hover { color: var(--accent); }

/* ---------- ohlc / replay badge ---------- */
.ohlc {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 5px 12px;
  border-radius: 5px;
  background: rgba(10, 12, 16, .9);
  border: 1px solid var(--line-2);
  font: 11px/1 var(--mono);
  color: #aab5c2;
  pointer-events: none;
  z-index: 6;
  white-space: nowrap;
}
.ohlc b { font-weight: 500; }
.ohlc .up { color: var(--up); }
.ohlc .down { color: var(--down); }

.replaybadge {
  position: absolute;
  left: 238px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(240, 179, 78, .1);
  border: 1px solid rgba(240, 179, 78, .32);
  color: #f0c37a;
  font: 11px/1 var(--mono);
  z-index: 5;
}
.replaybadge i { width: 5px; height: 5px; border-radius: 50%; background: var(--warn); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- statusbar ---------- */
#statusbar {
  flex: none;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: #6e7a88;
  font: 10.5px/1 var(--mono);
  background: #0d0f13;
  border-top: 1px solid var(--line);
}
#statusbar .ssep { width: 1px; height: 12px; background: var(--line-2); }
#statusbar .spacer { flex: 1; }
.modebtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 18px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(47, 224, 200, .28);
  background: rgba(47, 224, 200, .07);
  color: #7df0df;
  font: 10px/1 var(--mono);
  white-space: nowrap;
}
.modebtn i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.modebtn.real { border-color: rgba(240, 179, 78, .34); background: rgba(240, 179, 78, .08); color: #f0c37a; }
.modebtn.real i { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.modebtn:hover { filter: brightness(1.18); }

.gex-meta {
  margin: 4px 0 2px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: #8b96a4;
  font: 9.5px/1.6 var(--mono);
  white-space: pre-line;
}
.legend label.disabled { opacity: .35; pointer-events: none; }

/* ---------- side ---------- */
#side {
  flex: none;
  width: 318px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 40px 6px 26px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
}
#side[hidden] { display: none; }
.side-head {
  flex: none;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--line);
  color: #cfd8e3;
  font-size: 12px;
  letter-spacing: .3px;
  background: linear-gradient(180deg, #161920, #12151a);
}

#bookView { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 8px 8px 6px; }
.book-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 4px 8px;
}
.book-top b { font: 600 16px/1 var(--mono); letter-spacing: 1px; color: #e8f1fa; }
.book-top em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .6px;
  color: #7c8794;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 2px 4px;
  margin-left: 4px;
}
#bookLast { font: 13px/1 var(--mono); color: #7df0df; }
.book-cols { display: grid; grid-template-columns: 1fr 1fr; padding: 0 6px 4px; color: #5f6b79; font-size: 10px; }
.book-cols span:last-child { text-align: right; }
.book-rows { display: flex; flex-direction: column; gap: 1px; }
.book-rows .row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  height: 21px;
  padding: 0 6px;
  font: 11px/1 var(--mono);
  overflow: hidden;
}
.book-rows .row .bar {
  position: absolute;
  top: 1px; bottom: 1px;
  right: 0;
  border-radius: 2px;
  opacity: .13;
}
.book-rows.asks .row .bar { background: var(--down); }
.book-rows.bids .row .bar { background: var(--up); }
.book-rows .row .p { position: relative; z-index: 1; }
.book-rows.asks .row .p { color: #f2818f; }
.book-rows.bids .row .p { color: #63d3ab; }
.book-rows .row .q { position: relative; z-index: 1; text-align: right; color: #93a0af; }
.book-rows .row.big .q { color: #e6eef7; font-weight: 600; }
.book-rows .row.flash { animation: flash .3s ease; }
@keyframes flash { from { background: rgba(255, 255, 255, .09); } to { background: transparent; } }
.spread {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 26px;
  padding: 0 6px;
  margin: 3px 0;
  color: #7e8a98;
  font: 10.5px/1 var(--mono);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.spread i { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--line-2) 0 3px, transparent 3px 6px); }
.book-foot {
  display: flex;
  justify-content: space-between;
  padding: 8px 6px 2px;
  color: #66717f;
  font: 10px/1 var(--mono);
}
.book-foot b { color: #a9b5c3; font-weight: 500; }

/* ---------- replay ---------- */
#replayView { padding: 12px; }
.field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 5px; color: #8a95a3; font-size: 11px; }
.field select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: #0f1216;
  color: #d7e0ea;
  font-size: 12px;
  outline: none;
}
.seg { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line-2); border-radius: 5px; background: #0f1216; }
.seg button { flex: 1; height: 24px; border-radius: 3px; color: #85909e; font: 11px/1 var(--mono); }
.seg button.active { background: rgba(47, 224, 200, .14); color: #7df0df; }
.rep-actions { display: flex; gap: 8px; margin: 4px 0 14px; }
.rep-actions .primary {
  flex: 1;
  height: 34px;
  border-radius: 5px;
  background: linear-gradient(180deg, #3be8d0, #23bda8);
  color: #062622;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .3px;
}
.rep-actions .primary:hover { filter: brightness(1.06); }
.rep-actions .ghost {
  width: 62px;
  height: 34px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  color: #9aa5b3;
  font-size: 12px;
}
.rep-actions .ghost:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.progress { height: 4px; border-radius: 4px; background: #1c222a; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #1fa893, #45e9d1); transition: width .2s linear; }
.rep-meta { display: flex; justify-content: space-between; margin-top: 7px; color: #71808f; font: 10px/1 var(--mono); }
.rep-hint { margin: 16px 0 0; color: #5e6a78; font-size: 10.5px; line-height: 1.7; }

/* ---------- AI side ---------- */
#aiView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ai-side-top {
  flex: none;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.ai-side-model { display: flex; align-items: center; gap: 7px; color: #cdd8e3; font-size: 11.5px; }
.ai-side-model b { font-weight: 500; color: #e2ebf4; }
.ai-side-model .dot { width: 6px; height: 6px; border-radius: 50%; background: #4a5563; }
.ai-side-model .dot.on { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.ai-side-set { color: #7df0df; font-size: 10.5px; text-decoration: none; }
.ai-side-set:hover { text-decoration: underline; }

.ai-side-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.ai-side-empty {
  margin: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  text-align: center;
  color: #7c8794;
}
.ai-side-empty .as-ico {
  width: 34px; height: 34px;
  margin: 0 auto 10px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(47, 224, 200, .08);
  border: 1px solid rgba(47, 224, 200, .18);
  color: #6fe8d7;
  font-size: 15px;
}
.ai-side-empty p { margin: 0; color: #cfd9e4; font-size: 12px; }
.ai-side-empty span { font-size: 10.5px; line-height: 1.7; }
.ai-side-empty > * { flex: none; }
.ai-side-empty .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #3be8d0, #23bda8);
  color: #062622;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.ai-side-empty .tiny { margin: 0; color: #5f6b78; font-size: 10px; }
.ai-side-empty .linkbtn { font-size: 10px; padding: 0; }

.ai-msg { display: flex; flex-direction: column; gap: 3px; }
.ai-msg.user { align-items: flex-end; }
.ai-role { font: 9px/1 var(--mono); color: #5b6674; letter-spacing: .5px; }
.ai-bubble {
  max-width: 94%;
  padding: 8px 10px;
  border-radius: 8px;
  background: #151920;
  border: 1px solid #232a34;
  color: #c7d2de;
  font-size: 11.5px;
  line-height: 1.75;
  word-break: break-word;
}
.ai-msg.user .ai-bubble { background: rgba(47, 224, 200, .1); border-color: rgba(47, 224, 200, .24); color: #d9f5ef; }
.ai-bubble h4 { margin: 4px 0 2px; font-size: 11.5px; color: #eef5fb; }
.ai-bubble code { padding: 1px 4px; border-radius: 3px; background: rgba(255, 255, 255, .07); font: 10px var(--mono); color: #9ff0e4; }
.ai-bubble .li { margin: 1px 0; }
.ai-caret { color: var(--accent); animation: blink 1s steps(2) infinite; }
.ai-err { color: #f0818f; }

.ai-side-prompts { flex: none; display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px 0; }
.ai-side-prompts button {
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .02);
  color: #8a96a4;
  font-size: 9.5px;
}
.ai-side-prompts button:hover { border-color: rgba(47, 224, 200, .4); color: #9ff0e4; }

.ai-side-form { flex: none; display: flex; gap: 6px; padding: 8px 10px 4px; align-items: flex-end; }
.ai-side-form textarea {
  flex: 1;
  resize: none;
  min-height: 36px;
  max-height: 90px;
  padding: 8px 9px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: #0c0e12;
  color: #dfe7ef;
  font: 11.5px/1.5 var(--sans);
  outline: none;
}
.ai-side-form textarea:focus { border-color: rgba(47, 224, 200, .5); }
.ai-side-form button {
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: linear-gradient(180deg, #3be8d0, #23bda8);
  color: #062622;
  font-size: 11.5px;
  font-weight: 600;
}
.ai-side-form button:disabled { opacity: .45; }
.ai-side-foot { flex: none; padding: 0 10px 8px; color: #5a6572; font-size: 9px; }

.data-error {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 28px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: rgba(12, 14, 18, .92);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  text-align: center;
}
.data-error b { color: #e6eef6; font-size: 14px; }
.data-error span { color: #7f8b99; font-size: 11.5px; }
.data-error button {
  margin-top: 4px;
  height: 30px;
  padding: 0 14px;
  border-radius: 5px;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 224, 200, .35);
  color: #7df0df;
  font-size: 11.5px;
}
.data-error button:hover { background: rgba(47, 224, 200, .18); }

/* ---------- AI 桌面（iframe 承载 ai.html） ---------- */
#aiDesk {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: #0b0c0f;
}
.ai-desk-bar {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, #171a21, #121419);
  border-bottom: 1px solid var(--line);
}
.ai-desk-title { display: flex; align-items: center; gap: 8px; color: #dbe5ef; font-size: 12.5px; }
.ai-desk-title i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.ai-desk-title b { font-weight: 600; }
.ai-desk-title span { color: #6f7b89; font-size: 10.5px; }
.ai-desk-actions { display: flex; align-items: center; gap: 10px; }
.ai-desk-actions a { color: #7df0df; font-size: 11px; text-decoration: none; }
.ai-desk-actions a:hover { text-decoration: underline; }
.ai-desk-actions button {
  width: 28px; height: 28px;
  border-radius: 5px;
  color: #9aa5b2;
  font-size: 17px;
  line-height: 1;
}
.ai-desk-actions button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
#aiFrame { flex: 1; width: 100%; border: 0; background: #0b0c0f; }

/* ---------- popover ---------- */
.popmenu {
  position: fixed;
  z-index: 100;
  min-width: 220px;
  padding: 6px;
  border-radius: 8px;
  background: #161a21;
  border: 1px solid #2b323d;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.popmenu[hidden] { display: none; }
.popmenu .mhead { padding: 5px 9px 8px; color: #7e8a98; font: 10px/1 var(--mono); letter-spacing: .8px; }
.popmenu button {
  width: 100%;
  height: 30px;
  padding: 0 9px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #c3cdd9;
  font-size: 12.5px;
  text-align: left;
}
.popmenu button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.popmenu button.danger { color: #f0818f; }
.popmenu button.danger:hover { background: rgba(240, 87, 107, .1); }
.popmenu .sep { height: 1px; margin: 5px 4px; background: var(--line); }
.popmenu kbd {
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(47, 224, 200, .12);
  color: #7df0df;
  font: 9px/1 var(--mono);
}
.popmenu .arw { color: #5f6b79; }
.popmenu .row-check { justify-content: flex-start; gap: 9px; }
.popmenu .row-check i {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid #39424f;
  display: grid; place-items: center;
  font-size: 9px;
  color: transparent;
}
.popmenu .row-check.on i { background: var(--accent); border-color: var(--accent); color: #062622; }

#acctMenu { top: 46px; right: 10px; width: 244px; }
.acct-head { padding: 9px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 5px; }
.acct-name { display: flex; align-items: center; gap: 8px; color: #e9f1fa; font-weight: 600; font-size: 13px; }
.acct-name .ok { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 7px var(--up); }
.acct-exp { margin-top: 5px; color: #7c8794; font: 10.5px/1 var(--mono); }
.acct-exp span { color: #b9c6d4; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 8px 14px;
  border-radius: 6px;
  background: #1b212a;
  border: 1px solid #2e3742;
  color: #d6e0ea;
  font-size: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: toastIn .18s ease;
}
.toast.err { border-color: rgba(240, 87, 107, .4); color: #f5a2ac; }
.toast.ok { border-color: rgba(47, 224, 200, .35); color: #9df5e7; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- empty workspace ---------- */
#emptyState {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 6px;
  border: 1px dashed #2b323c;
  border-radius: 8px;
  color: var(--mut);
  background: rgba(255, 255, 255, .012);
}
#emptyState .es-icon { font-size: 34px; color: #39424f; line-height: 1; }
#emptyState p { margin: 2px 0 0; color: #cfd8e3; font-size: 14px; }
#emptyState span { font-size: 12px; color: #6f7b89; }
#emptyState button {
  margin-top: 12px;
  height: 32px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid rgba(47, 224, 200, .3);
  color: #7df0df;
  font-size: 12px;
}
#emptyState button:hover { background: rgba(47, 224, 200, .18); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .tools { display: none; }
  #side { position: absolute; right: 0; top: 0; bottom: 0; z-index: 50; margin: 0; border-radius: 0; box-shadow: -18px 0 40px rgba(0, 0, 0, .5); }
}
@media (max-width: 780px) {
  #rail { display: none; }
  #menubar { gap: 0; padding: 0 8px; overflow: hidden; }
  #brand { letter-spacing: 2px; margin-right: 4px; }
  #brand span { font-size: 12.5px; }
  #net, #btnDiscord, #btnGear { display: none !important; }
  .mtop { padding: 0 6px; font-size: 12px; }
  .mtop .caret { display: none; }
  .drag, .panel-actions { display: none; }
  #panelbar { gap: 6px; padding: 0 6px; }
  #legend { width: 168px; padding: 6px 8px 4px; }
  #legend label { font-size: 10.5px; }
  #statusbar #statHint { display: none; }
  .ws-badge { display: none; }
  #work { margin: 0; }
  #panel { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
  .pane-val { left: 40px; font-size: 10px; }
  .pane-title { font-size: 10px; }
}
