:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #0d1015;
  --panel-2: #11151b;
  --line: #20252e;
  --muted: #77808e;
  --text: #edf1f7;
  --green: #35e29a;
  --red: #ff667d;
  --accent: #97f750;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 48% -25%, #19211f 0, var(--bg) 40%); }
button, input { font: inherit; }
[v-cloak] { display: none; }
.muted { color: var(--muted); }

.topbar { height: 58px; padding: 0 max(24px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(9,11,15,.82); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: .13em; }
.brand > span:last-child span { color: var(--accent); }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; color: #071007; background: var(--accent); font: 600 13px "DM Mono", monospace; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.topbar-meta { display: flex; align-items: center; gap: 14px; font: 500 10px "DM Mono", monospace; letter-spacing: .1em; }
.network { color: #aeb7c4; display: flex; align-items: center; gap: 7px; }
.network i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.divider { width: 1px; height: 14px; background: var(--line); }

main { max-width: 1480px; margin: 0 auto; padding: 22px 24px 12px; }
.query-bar { min-height: 70px; }
.query-bar form { display: grid; grid-template-columns: minmax(280px, 1fr) 150px 148px; gap: 8px; }
.query-bar label { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border: 1px solid var(--line); background: var(--panel); }
.query-bar label:focus-within { border-color: #465043; box-shadow: inset 0 0 0 1px rgba(151,247,80,.08); }
.query-bar label > span { color: var(--muted); font: 500 9px "DM Mono", monospace; letter-spacing: .12em; }
.query-bar input { width: 100%; border: 0; outline: 0; padding: 0; background: transparent; color: var(--text); font: 500 12px "DM Mono", monospace; }
.query-bar input::placeholder { color: #454c57; }
.query-bar button { border: 1px solid var(--accent); background: var(--accent); color: #10160d; font: 600 10px "DM Mono", monospace; letter-spacing: .08em; cursor: pointer; transition: filter .15s, transform .15s; }
.query-bar button:hover { filter: brightness(1.08); }
.query-bar button:active { transform: translateY(1px); }
.query-bar button:disabled { opacity: .65; cursor: wait; }
.error { margin: 7px 0 0; color: var(--red); font: 11px "DM Mono", monospace; }

.market-head { min-height: 82px; display: flex; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); }
.instrument { display: flex; align-items: center; gap: 12px; }
.coin-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #343a44; border-radius: 50%; background: linear-gradient(145deg, #232a33, #101318); color: var(--accent); font: 500 13px "DM Mono", monospace; }
.instrument-name { font: 600 14px "DM Mono", monospace; }
.instrument-name span { color: var(--muted); font-weight: 400; }
.instrument-sub { margin-top: 4px; color: var(--muted); font-size: 10px; }
.price-block { display: flex; align-items: baseline; gap: 10px; }
.price-block strong { font: 500 21px "DM Mono", monospace; }
.price-block span { font: 500 11px "DM Mono", monospace; }
.update-state { margin-left: auto; color: var(--muted); display: flex; align-items: center; gap: 7px; font: 10px "DM Mono", monospace; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: #3f4650; }
.pulse.active { background: var(--green); box-shadow: 0 0 8px rgba(53,226,154,.8); }

.terminal-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 12px; padding-top: 12px; }
.panel { border: 1px solid var(--line); background: rgba(13,16,21,.92); }
.panel-head { min-height: 42px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 500 10px "DM Mono", monospace; letter-spacing: .11em; }
.panel-head > span { color: var(--muted); font: 10px "DM Mono", monospace; }
.tabs button { height: 42px; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--accent); background: none; color: #c8ced6; font: 500 10px "DM Mono", monospace; letter-spacing: .08em; }
.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font: 9px "DM Mono", monospace; }
.legend b { margin-left: 8px; padding: 3px 5px; color: #adb5c1; border: 1px solid var(--line); font-weight: 400; }
.buy-dot, .sell-dot { width: 6px; height: 6px; border-radius: 50%; }
.buy-dot { background: var(--green); }
.sell-dot { margin-left: 7px; background: var(--red); }
.chart-card { position: relative; min-height: 655px; overflow: hidden; }
#chart { width: 100%; height: 610px; }
.chart-empty { position: absolute; inset: 43px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); pointer-events: none; background: radial-gradient(circle, rgba(18,23,29,.55), rgba(13,16,21,.12) 45%, transparent 70%); }
.chart-empty strong { color: #c8ced8; font-size: 13px; font-weight: 500; }
.chart-empty small { font-size: 11px; }
.empty-orbit { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid #303740; border-radius: 50%; }
.empty-orbit:before { content: ""; width: 58px; height: 20px; position: absolute; border-top: 1px solid #303740; border-radius: 50%; transform: rotate(-25deg); }
.empty-orbit span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(151,247,80,.7); }
.spinner { display: inline-block; width: 11px; height: 11px; margin-right: 5px; border: 1px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
.spinner.large { width: 22px; height: 22px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.side-stack { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; min-height: 655px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; }
.stats-grid > div { min-height: 76px; padding: 11px 13px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--line); }
.stats-grid > div:nth-child(odd) { border-right: 1px solid var(--line); }
.stats-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.stats-grid span, .stats-grid small { color: var(--muted); font: 9px "DM Mono", monospace; }
.stats-grid strong { margin: 7px 0 5px; font: 500 16px "DM Mono", monospace; }
.stats-grid small b { font-weight: 400; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }

.orders-panel { min-height: 0; }
.order-columns, .order-row { display: grid; grid-template-columns: 1fr 86px 56px; align-items: center; column-gap: 8px; }
.order-columns { padding: 10px 13px; color: #555e6a; border-bottom: 1px solid var(--line); font: 9px "DM Mono", monospace; }
.order-columns span:not(:first-child) { text-align: right; }
.order-list { max-height: 218px; overflow: auto; scrollbar-width: thin; scrollbar-color: #2c333d transparent; }
.order-row { min-height: 43px; padding: 0 13px; border-bottom: 1px solid rgba(32,37,46,.7); font: 10px "DM Mono", monospace; }
.order-row > div { display: flex; align-items: center; gap: 8px; }
.order-row > div span { color: #929aa6; }
.order-row > strong, .order-row > span { text-align: right; font-weight: 400; }
.order-row > span { color: var(--muted); }
.buy-tag, .sell-tag { width: 31px; font-size: 8px; font-weight: 500; }
.buy-tag { color: var(--green); }
.sell-tag { color: var(--red); }
.no-orders { min-height: 126px; display: grid; place-items: center; color: #59616d; font: 10px "DM Mono", monospace; }
.fills-panel { margin-top: 12px; }
.fill-columns, .fill-row { display: grid; grid-template-columns: 100px 80px repeat(4, 1fr); align-items: center; column-gap: 12px; padding: 0 14px; font: 10px "DM Mono", monospace; }
.fill-columns { min-height: 34px; color: #555e6a; border-bottom: 1px solid var(--line); font-size: 9px; }
.fill-row { min-height: 42px; border-bottom: 1px solid rgba(32,37,46,.7); }
.fill-row:last-child { border-bottom: 0; }
.fill-row span { color: var(--muted); }
.fill-row strong { font-weight: 400; }

footer { max-width: 1480px; margin: 0 auto; padding: 10px 24px 18px; display: flex; justify-content: space-between; color: #4b535f; font: 9px "DM Mono", monospace; letter-spacing: .05em; }
footer a { color: #7e8794; }

@media (max-width: 980px) {
  .terminal-grid { grid-template-columns: 1fr; }
  .chart-card { min-height: 520px; }
  #chart { height: 475px; }
  .side-stack { min-height: auto; grid-template-columns: 1fr 1fr; grid-template-rows: none; }
}

@media (max-width: 680px) {
  main { padding: 14px 12px 8px; }
  .topbar { padding: 0 14px; }
  .topbar-meta .divider, .topbar-meta .muted { display: none; }
  .query-bar form { grid-template-columns: 1fr 92px; }
  .query-bar button { min-height: 40px; grid-column: 1 / -1; }
  .market-head { gap: 12px; flex-wrap: wrap; padding: 14px 0; }
  .price-block { margin-left: auto; }
  .update-state { width: 100%; margin: 0; }
  .terminal-grid { padding-top: 8px; }
  .side-stack { grid-template-columns: 1fr; }
  .chart-card { min-height: 435px; }
  #chart { height: 390px; }
  .fill-columns, .fill-row { grid-template-columns: 62px 52px 1fr 1.25fr; column-gap: 6px; padding: 0 10px; font-size: 9px; }
  .fill-columns .optional, .fill-row .optional { display: none; }
  footer { padding: 8px 12px 16px; gap: 8px; flex-direction: column; }
}
