:root {
  --bg: #081018;
  --panel: rgba(11, 18, 30, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eaf1ff;
  --muted: #95a4be;
  --accent: #58e2be;
  --accent-2: #75a7ff;
  --up: #21c46a;
  --down: #ff6f72;
  --warn: #f5c34f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[v-cloak] {
  display: none;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(117, 167, 255, 0.15), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(88, 226, 190, 0.1), transparent 24%),
    linear-gradient(180deg, #070d15 0%, #0a111b 44%, #071019 100%);
}

button,
input {
  font: inherit;
}

.app-shell,
.state-screen {
  min-height: 100vh;
}

.state-screen {
  display: grid;
  place-items: center;
  padding: 24px;
}

.state-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.state-card-error {
  border-color: rgba(255, 111, 114, 0.4);
}

.state-card h1,
.brand h1,
.title h2 {
  margin: 0;
}

.state-card p,
.brand p,
.sub,
.muted {
  color: var(--muted);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  min-width: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 14px;
}

.summary-card,
.stat,
.watch-item,
.field,
.chip,
.history {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.summary-card,
.stat {
  border-radius: 16px;
  padding: 12px;
}

.summary-line {
  margin-top: 4px;
  font-size: 12px;
}

.watchlist {
  display: grid;
  gap: 6px;
  align-content: start;
}

.watch-item {
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "symbol name"
    "price change"
    "position pnl";
  gap: 4px 8px;
}

.watch-item.active {
  background: linear-gradient(180deg, rgba(117, 167, 255, 0.16), rgba(88, 226, 190, 0.08));
  border-color: rgba(117, 167, 255, 0.35);
}

.watch-symbol {
  grid-area: symbol;
  font-size: 16px;
  font-weight: 800;
}

.watch-meta {
  grid-area: name;
  justify-self: end;
  font-size: 11px;
  color: var(--muted);
}

.watch-price {
  grid-area: price;
  font-weight: 700;
}

.watch-change {
  grid-area: change;
  justify-self: end;
  font-size: 12px;
  font-weight: 700;
}

.watch-balance {
  grid-area: position;
  color: var(--muted);
  font-size: 11px;
}

.watch-pnl {
  grid-area: pnl;
  justify-self: end;
  font-size: 11px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.status-banner {
  padding: 12px 14px;
  border: 1px solid rgba(245, 195, 79, 0.35);
  border-radius: 14px;
  background: rgba(245, 195, 79, 0.1);
  color: #ffe39a;
}

.topbar,
.topbar-left,
.topbar-right,
.tf-group,
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar {
  justify-content: space-between;
  padding: 14px;
}

.topbar-right {
  margin-left: auto;
}

.field {
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  min-height: 46px;
}

.field label,
.k,
th {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input {
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
}

.field input[type="datetime-local"] {
  width: 220px;
}

.field input[type="number"] {
  width: 74px;
  text-align: center;
}

.trade-estimate {
  margin-left: 8px;
  font-size: 12px;
}

.tf-group {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.btn,
.tf-btn {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
}

.tf-btn.active {
  background: linear-gradient(135deg, rgba(88, 226, 190, 0.26), rgba(117, 167, 255, 0.22));
}

.btn-buy {
  background: linear-gradient(135deg, #79f0c8, #2acb88);
  color: #04111b;
}

.btn-sell {
  background: linear-gradient(135deg, #ff9997, #ff657d);
  color: #04111b;
}

.btn-close {
  background: linear-gradient(135deg, #ffd76c, #f0b64a);
  color: #04111b;
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
}

.chart-panel,
.history-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.chart-shell {
  position: relative;
  min-height: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)),
    radial-gradient(circle at 50% 0%, rgba(88, 226, 190, 0.06), transparent 35%);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 8px;
}

.overlay-pill {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(6, 13, 21, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
}

.stats,
.history-panel-top {
  display: grid;
  gap: 10px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-panel-top {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v {
  margin-top: 6px;
  font-size: 18px;
  font-weight: 800;
}

.history {
  min-height: 0;
  overflow: auto;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: rgba(8, 15, 24, 0.96);
}

.buy td:nth-child(3) {
  color: var(--up);
}

.sell td:nth-child(3) {
  color: var(--down);
}

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

.pos-up {
  color: var(--up);
}

.pos-down {
  color: var(--down);
}

@media (max-width: 1240px) {
  .app {
    grid-template-columns: 1fr;
  }

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

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .field input[type="datetime-local"] {
    width: 180px;
  }

  .history-panel-top,
  .stats {
    grid-template-columns: 1fr;
  }
}
