:root {
  --bg: #090a0c;
  --panel: #111318;
  --panel-2: #181b22;
  --line: #2a2f39;
  --text: #e9edf5;
  --muted: #9ca3b1;
  --accent: #f1ca66;
  --bid: #ff6b8a;
  --ask: #5bb6ff;
  --good: #57da99;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #0b0c10, #060608 40%, #040506);
  color: var(--text);
  font-family: "IBM Plex Sans KR", "Segoe UI", sans-serif;
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
}

.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 108px;
  display: grid;
  grid-template-columns: 260px 1fr 540px;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 10, 12, 0.96);
  backdrop-filter: blur(8px);
  z-index: 30;
}

.top-left,
.top-center,
.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-center {
  justify-content: center;
}

.top-right {
  justify-content: flex-end;
}

.logo-box {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #161922;
  color: var(--muted);
  font-weight: 600;
}

.small {
  font-size: 11px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.client-name {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 700;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

input,
select,
button {
  background: #161a23;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  padding: 7px 10px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: #58657a;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.summary-card {
  width: 120px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #151923;
}

.summary-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.summary-card h3 {
  margin: 5px 0 0;
  font-size: 14px;
  font-weight: 700;
}

.header-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tab {
  width: 92px;
  font-size: 11px;
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.left-sidebar {
  position: fixed;
  top: 108px;
  left: 0;
  bottom: 0;
  width: 260px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #0b0d12;
  overflow: auto;
}

.user-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141923;
  margin-bottom: 10px;
}

.user-box p {
  margin: 0;
  color: #cad2e0;
  font-size: 13px;
}

.search-box {
  margin-bottom: 10px;
}

.menu-title {
  margin: 8px 0;
  font-size: 12px;
  color: var(--muted);
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-item {
  padding: 9px;
  border-radius: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: #cad3e2;
  margin-bottom: 5px;
  border: 1px solid transparent;
}

.tree-item.selected {
  color: var(--bid);
  border-color: rgba(255, 107, 138, 0.35);
  background: rgba(255, 107, 138, 0.08);
}

.hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.main-content {
  margin-top: 108px;
  margin-left: 260px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.ticker-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
}

.ticker-bar h1 {
  margin: 3px 0 0;
  color: var(--accent);
  font-size: 34px;
  font-weight: 700;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.orderbook {
  padding: 10px;
}

.orderbook-head {
  display: grid;
  grid-template-columns: 1fr 170px 1fr;
  align-items: center;
  margin-bottom: 10px;
}

.head-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.head-group.right {
  justify-content: flex-end;
}

.head-group.center {
  justify-content: center;
}

.head-group h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.icon-btn {
  min-height: 24px;
  padding: 2px 8px;
}

.orderbook-grid {
  display: grid;
  grid-template-columns: 44px 1.2fr 1fr 1fr 1fr 1fr 1px 1fr 1fr 1fr 1fr 1.2fr 44px;
  gap: 5px;
  align-items: center;
}

.header-row {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.orderbook-rows {
  max-height: 430px;
  overflow: auto;
}

.row {
  min-height: 28px;
  border-bottom: 1px solid rgba(62, 67, 80, 0.35);
}

.cell {
  position: relative;
  padding: 4px 6px;
  font-size: 12px;
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
}

.cell.action {
  text-align: center;
  color: var(--muted);
}

.cell.price {
  font-weight: 700;
}

.cell.bid {
  color: #ffc6d3;
}

.cell.ask {
  color: #c6e6ff;
}

.split-line {
  background: var(--line);
  width: 1px;
  height: 100%;
}

.heat::before {
  content: "";
  position: absolute;
  inset: 2px;
  width: var(--heat);
  border-radius: 3px;
  z-index: 0;
}

.heat > * {
  position: relative;
  z-index: 1;
}

.bid-heat::before {
  background: linear-gradient(90deg, rgba(255, 107, 138, 0.45), rgba(255, 107, 138, 0.08));
}

.ask-heat::before {
  background: linear-gradient(90deg, rgba(91, 182, 255, 0.45), rgba(91, 182, 255, 0.08));
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 10px;
}

.panel-title {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-title h3 {
  margin: 0;
  font-size: 13px;
}

.order-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.order-form button {
  grid-column: span 2;
  min-height: 38px;
  border-color: rgba(87, 218, 153, 0.5);
  color: var(--good);
}

.cancel-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 0 10px 10px;
  align-items: end;
}

pre {
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
  color: #c6cfdd;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: "IBM Plex Mono", monospace;
  height: 260px;
  overflow: auto;
}

#result {
  height: 350px;
}

details {
  padding: 8px 10px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (max-width: 1440px) {
  .top-header {
    grid-template-columns: 230px 1fr 500px;
  }

  .summary-card {
    width: 108px;
  }
}

@media (max-width: 1240px) {
  .top-header {
    position: static;
    height: auto;
    grid-template-columns: 1fr;
  }

  .left-sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-content {
    margin: 0;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
  }
}
