:root {
  color-scheme: dark;
  --bg: #080a0d;
  --sidebar: #0c0f13;
  --surface: #11161c;
  --surface-2: #171d24;
  --line: #28313b;
  --line-soft: #1d252d;
  --text: #f4f7fa;
  --muted: #929ca8;
  --faint: #687381;
  --accent: #00a884;
  --accent-2: #2f8cff;
  --green: #2ecc8f;
  --red: #f25f6b;
  --amber: #e4aa45;
  --sidebar-w: 226px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
button { color: inherit; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--line-soft);
}
.brand { height: 78px; display: flex; align-items: center; gap: 12px; padding: 0 22px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: var(--accent); color: #03110e; font-weight: 900; }
.brand b { display: block; font-size: 14px; }
.brand small { display: block; margin-top: 4px; color: var(--faint); font-size: 8px; font-weight: 800; letter-spacing: 1.4px; }
.nav { display: grid; gap: 4px; padding: 20px 12px; }
.nav-item { height: 42px; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--muted); text-align: left; padding: 0 12px; cursor: pointer; font-weight: 700; }
.nav-item:hover, .nav-item.active { background: var(--surface); color: var(--text); }
.nav-item.active { border-left-color: var(--accent); }
.sidebar-foot { margin-top: auto; padding: 18px 20px; border-top: 1px solid var(--line-soft); }
.sidebar-foot span { display: block; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: 1.3px; }
.sidebar-foot strong { display: block; margin-top: 10px; color: var(--amber); font-size: 12px; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-w); padding: 102px 30px 42px; }
.topbar {
  position: fixed; inset: 0 0 auto var(--sidebar-w); z-index: 10; height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 0 30px; background: rgba(8,10,13,.94); border-bottom: 1px solid var(--line-soft); backdrop-filter: blur(12px);
}
.eyebrow { margin: 0 0 6px; color: var(--faint); font-size: 9px; font-weight: 850; letter-spacing: 1.5px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 20px; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.runtime-pill { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 3px rgba(104,115,129,.14); }
.status-dot.live { background: var(--green); box-shadow: 0 0 0 3px rgba(46,204,143,.14); }
.status-dot.warning { background: var(--amber); box-shadow: 0 0 0 3px rgba(228,170,69,.14); }
.status-dot.error { background: var(--red); box-shadow: 0 0 0 3px rgba(242,95,107,.14); }
.button, .icon-button {
  min-height: 36px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 750; font-size: 12px;
}
.button { padding: 0 14px; }
.icon-button { width: 42px; }
.button:hover, .icon-button:hover { border-color: #3d4a57; background: #1c242d; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #04100d; }
.button.subtle { background: transparent; }
.button.full { width: 100%; min-height: 42px; }
.text-button { border: 0; background: transparent; color: var(--accent-2); cursor: pointer; font-size: 12px; font-weight: 800; }

.view { display: none; max-width: 1580px; margin: 0 auto; }
.view.active { display: block; }
.command-band {
  min-height: 150px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .45fr); gap: 22px; align-items: end;
  margin-bottom: 14px; padding: 24px; border: 1px solid var(--line); background: linear-gradient(135deg, #12191f 0%, #0f1419 52%, #09221d 100%);
}
.command-band h2 { max-width: 820px; margin-bottom: 10px; font-size: 28px; line-height: 1.15; }
.command-band p:not(.eyebrow) { max-width: 760px; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.simulate-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid #303b46; border-radius: 0; outline: 0; background: #0c1116; color: var(--text);
}
input:focus { border-color: #5a6876; box-shadow: 0 0 0 2px rgba(90,104,118,.16); }
.field label { display: block; margin-bottom: 8px; color: #aab4bf; font-size: 11px; font-weight: 700; }
.input-unit { display: flex; }
.input-unit input { border-right: 0; }
.input-unit span { min-width: 54px; display: grid; place-items: center; border: 1px solid #303b46; background: var(--surface-2); color: var(--muted); font-size: 10px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.metric { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.metric strong { display: block; overflow: hidden; font-family: Consolas, monospace; font-size: 23px; line-height: 1.1; text-overflow: ellipsis; }
.metric small { display: block; margin-top: 8px; color: var(--faint); font-size: 10px; }

.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.panel { border: 1px solid var(--line); background: var(--surface); }
.panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.news-feed { display: grid; }
.news-card { padding: 18px; border-bottom: 1px solid var(--line-soft); }
.news-card:last-child { border-bottom: 0; }
.news-card header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.news-card b { display: block; font-size: 13px; }
.news-card time { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; }
.news-card p { margin-bottom: 14px; color: #d6dde4; line-height: 1.55; }
.score { min-width: 42px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); font-family: Consolas, monospace; font-weight: 800; }
.score.warm { border-color: rgba(228,170,69,.42); color: var(--amber); }
.score.hot { border-color: rgba(46,204,143,.45); color: var(--green); }
.asset-row { display: flex; flex-wrap: wrap; gap: 7px; }
.asset-chip { min-height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
button.asset-chip { cursor: pointer; }
.asset-chip.futures { border-color: rgba(0,168,132,.45); background: rgba(0,168,132,.10); color: var(--text); }
.asset-chip.watch { color: var(--faint); }
.news-card footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.news-card a, .news-card footer span { color: var(--faint); font-size: 11px; text-decoration: none; }

.order-panel { position: sticky; top: 96px; }
.order-form { display: grid; gap: 16px; padding: 18px; }
.side-control { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); }
.side-control button { height: 38px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-weight: 850; }
.side-control button:last-child { border-right: 0; }
.side-control button.buy.active { background: rgba(46,204,143,.14); color: var(--green); }
.side-control button.sell.active { background: rgba(242,95,107,.14); color: var(--red); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 2px; cursor: pointer; }
.switch-row span b { display: block; margin-bottom: 4px; font-size: 11px; }
.switch-row span small { color: var(--faint); font-size: 9px; }
.switch-row input { display: none; }
.switch-row i { position: relative; flex: 0 0 auto; width: 36px; height: 20px; background: #2a343e; }
.switch-row i::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #8994a0; transition: transform .2s; }
.switch-row input:checked + i { background: rgba(46,204,143,.25); }
.switch-row input:checked + i::after { transform: translateX(16px); background: var(--green); }
.order-result { min-height: 58px; padding: 14px 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; line-height: 1.55; }

.market-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.market-tile { min-height: 96px; padding: 16px 18px; border: 0; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; cursor: pointer; }
.market-tile:hover { background: #172029; }
.market-tile span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 10px; font-weight: 850; }
.market-tile b { display: block; font-family: Consolas, monospace; font-size: 18px; }
.market-tile small { display: block; margin-top: 8px; font-size: 10px; }
.positive-text { color: var(--green) !important; }
.negative-text { color: var(--red) !important; }

.setup-panel { max-width: 980px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; }
.setup-grid div { min-height: 96px; padding: 18px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.setup-grid b { display: block; margin-bottom: 8px; font-family: Consolas, monospace; font-size: 12px; }
.setup-grid span { color: var(--muted); font-size: 12px; line-height: 1.55; }

.empty-state { min-height: 260px; display: grid; place-items: center; color: var(--faint); }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); }
.modal-card { width: min(420px, 100%); display: grid; gap: 22px; padding: 24px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.modal-card h2 { margin-bottom: 9px; font-size: 18px; }
.modal-card p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 360px; padding: 13px 16px; border: 1px solid var(--line); background: #191f26; color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.4); font-size: 11px; }
.toast.error { border-color: rgba(242,95,107,.5); color: #ffb2ba; }

@media (max-width: 1100px) {
  :root { --sidebar-w: 74px; }
  .brand { justify-content: center; padding: 0; }
  .brand > span:last-child, .sidebar-foot { display: none; }
  .nav-item { padding: 0; text-align: center; }
  .command-band, .desk-grid { grid-template-columns: 1fr; }
  .order-panel { position: static; }
  .market-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  .sidebar { position: fixed; inset: auto 0 0 0; z-index: 20; width: 100%; height: 58px; border: 0; border-top: 1px solid var(--line); }
  .brand, .sidebar-foot { display: none; }
  .nav { height: 100%; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 0; }
  .nav-item { height: 100%; border-left: 0; border-top: 2px solid transparent; }
  .nav-item.active { border-top-color: var(--accent); }
  .workspace { margin-left: 0; padding: 88px 12px 82px; }
  .topbar { left: 0; height: 72px; padding: 0 12px; }
  .runtime-pill, .icon-button { display: none; }
  h1 { font-size: 17px; }
  .command-band { min-height: 0; padding: 18px; }
  .command-band h2 { font-size: 21px; }
  .simulate-form { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric strong { font-size: 18px; }
  .market-grid, .setup-grid { grid-template-columns: 1fr; }
  .news-card footer { align-items: flex-start; flex-direction: column; }
}
