/* TRADE ARENA — базовые стили, дизайн-система терминала */
:root {
  --bg: #04070e;
  --bg-2: #070c17;
  --panel: rgba(16, 24, 41, .74);
  --panel-solid: #0e1626;
  --panel-head: rgba(23, 33, 54, .8);
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .28);
  --text: #e8eef9;
  --muted: #8b9ab3;
  --dim: #5c6b85;
  --up: #4ade80;
  --down: #f87171;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --gold: #fbbf24;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  --mono: 'Consolas', 'SF Mono', 'JetBrains Mono', 'Menlo', monospace;
}

.accent-violet { --accent: #a78bfa; }
.accent-green { --accent: #4ade80; }
.accent-orange { --accent: #fb923c; }
.accent-pink { --accent: #f472b6; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(34, 211, 238, .10), transparent 62%),
    radial-gradient(900px 600px at 92% 4%, rgba(167, 139, 250, .10), transparent 60%),
    radial-gradient(1000px 700px at 50% 108%, rgba(74, 222, 128, .07), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(148, 163, 184, .05); }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .25); border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .4); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------------- панели ---------------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .18), transparent);
  pointer-events: none;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-head);
  flex: 0 0 auto;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-body { padding: 14px 16px; min-height: 0; overflow: auto; flex: 1 1 auto; }
.panel-body.tight { padding: 10px 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, .08);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip.accent { color: var(--accent); border-color: rgba(34, 211, 238, .4); background: rgba(34, 211, 238, .12); }
.chip.up { color: var(--up); border-color: rgba(74, 222, 128, .35); background: rgba(74, 222, 128, .12); }
.chip.down { color: var(--down); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .12); }
.chip.gold { color: var(--gold); border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .12); }

/* ---------------- формы ---------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(148, 163, 184, .10);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn:hover:not(:disabled) { background: rgba(148, 163, 184, .18); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.tiny { padding: 4px 8px; font-size: 11px; border-radius: 8px; }

.btn.primary {
  background: linear-gradient(135deg, rgba(34, 211, 238, .95), rgba(14, 165, 233, .95));
  border-color: rgba(34, 211, 238, .6);
  color: #04121a;
  box-shadow: 0 8px 24px rgba(34, 211, 238, .25);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(34, 211, 238, .38); }

.btn.success {
  background: linear-gradient(135deg, rgba(74, 222, 128, .95), rgba(22, 163, 74, .95));
  border-color: rgba(74, 222, 128, .5);
  color: #04170c;
}
.btn.danger {
  background: linear-gradient(135deg, rgba(248, 113, 113, .92), rgba(185, 28, 28, .92));
  border-color: rgba(248, 113, 113, .5);
  color: #1b0505;
}
.btn.warn {
  background: linear-gradient(135deg, rgba(251, 191, 36, .92), rgba(217, 119, 6, .92));
  border-color: rgba(251, 191, 36, .5);
  color: #1a1204;
}
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }

.input, .select, .textarea {
  width: 100%;
  background: rgba(6, 11, 21, .8);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.input.mono, .input[type="number"] { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, .6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .14);
}
.input.small { padding: 6px 8px; font-size: 12px; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.hint { font-size: 11px; color: var(--dim); line-height: 1.45; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 999px; background: rgba(148, 163, 184, .22); position: relative; cursor: pointer; transition: background .2s ease; flex: 0 0 auto; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; transition: transform .2s ease, background .2s ease; }
.switch input:checked { background: rgba(34, 211, 238, .5); }
.switch input:checked::after { transform: translateX(18px); background: #04121a; }

/* ---------------- анимации ---------------- */
@keyframes flash-up { 0% { background: rgba(74, 222, 128, .35); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: rgba(248, 113, 113, .32); } 100% { background: transparent; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .45); } 70% { box-shadow: 0 0 0 14px rgba(34, 211, 238, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); } }
@keyframes slide-down { from { opacity: 0; transform: translate(-50%, -26px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.flash-up { animation: flash-up 1s ease-out; }
.flash-down { animation: flash-down 1s ease-out; }

/* У карточек активов — своя мягкая подсветка: фон и градиент не подменяем
   (иначе карточка «вспыхивает» плоским цветом при каждом обновлении цены). */
@keyframes card-up { 0% { box-shadow: 0 0 0 1px rgba(74, 222, 128, .6), 0 0 30px rgba(74, 222, 128, .22); } 100% { box-shadow: var(--shadow); } }
@keyframes card-down { 0% { box-shadow: 0 0 0 1px rgba(248, 113, 113, .6), 0 0 30px rgba(248, 113, 113, .22); } 100% { box-shadow: var(--shadow); } }
.asset-card.flash-up { animation: card-up .9s ease-out; }
.asset-card.flash-down { animation: card-down .9s ease-out; }

/* ---------------- тосты ---------------- */
#toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 4000;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  background: rgba(14, 22, 38, .96);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  animation: pop-in .22s ease;
  box-shadow: var(--shadow);
}

.toast.info { border-left-color: var(--accent); }
.toast.ok { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .5s ease; }

/* ---------------- таблицы ---------------- */
table.ta { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ta th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.ta td { padding: 8px 10px; border-bottom: 1px solid rgba(148, 163, 184, .07); vertical-align: middle; }
table.ta tr:hover td { background: rgba(148, 163, 184, .05); }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge.up { background: rgba(74, 222, 128, .16); color: var(--up); }
.badge.down { background: rgba(248, 113, 113, .16); color: var(--down); }
.badge.gray { background: rgba(148, 163, 184, .16); color: var(--muted); }
.badge.gold { background: rgba(251, 191, 36, .18); color: var(--gold); }

.stars { color: var(--gold); letter-spacing: 2px; font-size: 12px; }
