@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --bg: #06080d;
  --bg-soft: #0a0e15;
  --surface: #0e131c;
  --surface-2: #131a26;
  --border: #1b2433;
  --border-2: #263248;
  --green: #00d68f;
  --green-dim: rgba(0, 214, 143, 0.10);
  --red: #ff4d6a;
  --red-dim: rgba(255, 77, 106, 0.10);
  --blue: #3d8bff;
  --blue-dim: rgba(61, 139, 255, 0.10);
  --amber: #ffb347;
  --amber-dim: rgba(255, 179, 71, 0.12);
  --text: #e6edf7;
  --muted: #7587a0;
  --accent: #00d68f;
  --radius: 14px;
  --font: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }

/* ── App shell ─────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 24px;
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.brand .logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #04110b; font-weight: 800;
}
.brand span em { color: var(--green); font-style: normal; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); background: var(--surface-2); font-weight: 600; }
.nav-link .ico { width: 20px; text-align: center; opacity: 0.9; }

.sidebar .spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.user-chip .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: var(--green);
}
.user-chip .info { overflow: hidden; }
.user-chip .info .name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .info a { font-size: 0.72rem; color: var(--muted); }
.user-chip .info a:hover { color: var(--red); }

.content { flex: 1; padding: 28px 32px; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ── Cards / grids ─────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-title {
  font-size: 0.7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-family: var(--mono); font-weight: 600;
  margin-bottom: 16px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 18px; }
}

/* ── Stats ─────────────────────────────────────────── */
.stat-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.stat-tile .lbl { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); margin-bottom: 6px; }
.stat-tile .val { font-size: 1.3rem; font-weight: 700; font-family: var(--mono); }
.g { color: var(--green); } .r { color: var(--red); } .b { color: var(--blue); } .a { color: var(--amber); } .m { color: var(--muted); }

/* ── Forms ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--mono); font-weight: 600; }
.field input, .field select {
  background: var(--bg-soft);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 0.9rem;
  font-family: var(--mono);
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.field input:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,214,143,0.12); }
.field .hint { font-size: 0.72rem; color: var(--muted); }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  border: none; border-radius: 10px;
  font-family: var(--font);
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, box-shadow 0.15s;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--green), #00b87b); color: #04110b; box-shadow: 0 6px 20px rgba(0,214,143,0.25); }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: 8px; }

/* ── Badges / pills ────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 600;
  border: 1px solid var(--border-2);
  background: var(--surface);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.dot.off { background: var(--red); }

.badge { padding: 3px 10px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; font-family: var(--mono); }
.badge-green { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,214,143,0.35); }
.badge-red { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,77,106,0.35); }
.badge-amber { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(255,179,71,0.35); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-2); }

/* ── Flash messages ────────────────────────────────── */
.flash { padding: 13px 16px; border-radius: 10px; font-size: 0.85rem; margin-bottom: 16px; border: 1px solid; }
.flash.error { background: var(--red-dim); color: var(--red); border-color: rgba(255,77,106,0.3); }
.flash.success { background: var(--green-dim); color: var(--green); border-color: rgba(0,214,143,0.3); }
.flash.info { background: var(--blue-dim); color: var(--blue); border-color: rgba(61,139,255,0.3); }

/* ── Log terminal ──────────────────────────────────── */
.terminal {
  background: #05070b;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.terminal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.terminal-head span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--mono); }
.terminal-body {
  height: 320px; overflow-y: auto;
  padding: 14px 18px;
  font-family: var(--mono); font-size: 0.76rem; line-height: 1.75;
}
.terminal-body .line { color: var(--muted); }
.terminal-body .line.win { color: var(--green); }
.terminal-body .line.loss { color: var(--red); }
.terminal-body .line.entry { color: var(--amber); }
.terminal-body .line.info { color: var(--blue); }
.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ── Tables ────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table th {
  text-align: left; padding: 12px 16px;
  font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
  font-family: var(--mono); font-weight: 600;
  border-bottom: 1px solid var(--border-2);
  background: var(--surface-2);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.table tr:hover td { background: rgba(255,255,255,0.015); }
.mono { font-family: var(--mono); }

/* ── Auth pages ────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 40% at 70% 0%, rgba(0,214,143,0.07), transparent),
    radial-gradient(ellipse 50% 40% at 20% 100%, rgba(61,139,255,0.06), transparent),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 38px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
}
.auth-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); font-size: 0.86rem; margin-bottom: 28px; }
.auth-card .alt { margin-top: 20px; text-align: center; font-size: 0.82rem; color: var(--muted); }

/* ── Live market monitor ───────────────────────────── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,214,143,0.45); }
  50% { box-shadow: 0 0 0 7px rgba(0,214,143,0); }
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes scanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.dot.on { animation: pulse-glow 1.6s ease-out infinite; }

.pill.live {
  border-color: rgba(0,214,143,0.45);
  background: var(--green-dim);
  color: var(--green);
}

.monitor-strip {
  display: flex; align-items: stretch; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
.monitor-strip.live { border-color: rgba(0,214,143,0.3); }
.monitor-strip.live::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 25%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  animation: scanline 3s linear infinite;
}

.monitor-cell { display: flex; flex-direction: column; gap: 4px; justify-content: center; min-width: 120px; }
.monitor-cell .lbl { font-size: 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--mono); }
.monitor-cell .val { font-size: 1.05rem; font-weight: 700; font-family: var(--mono); }
.monitor-sep { width: 1px; background: var(--border); margin: 2px 4px; }
.monitor-cell.grow { flex: 1; min-width: 200px; }

.price-flash-up { color: var(--green) !important; transition: color 0.15s; }
.price-flash-down { color: var(--red) !important; transition: color 0.15s; }

.candle-progress {
  height: 5px; border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 6px;
}
.candle-progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  border-radius: 3px;
  transition: width 1s linear;
}

.phase-label { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-family: var(--mono); }
.phase-label .spin-ico { display: inline-block; animation: blink 1.2s infinite; }

.term-cursor::after {
  content: '▋';
  color: var(--green);
  animation: blink 1s infinite;
  margin-left: 2px;
}

/* ── Toasts ────────────────────────────────────────── */
.toast-wrap {
  position: fixed; top: 20px; right: 20px; z-index: 3000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  min-width: 260px; max-width: 380px;
  padding: 13px 17px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  font-size: 0.85rem;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0; transform: translateX(24px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast .t-ico {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800;
}
.toast.success { border-color: rgba(0,214,143,0.4); }
.toast.success .t-ico { background: var(--green-dim); color: var(--green); }
.toast.error { border-color: rgba(255,77,106,0.4); }
.toast.error .t-ico { background: var(--red-dim); color: var(--red); }
.toast.info { border-color: rgba(61,139,255,0.4); }
.toast.info .t-ico { background: var(--blue-dim); color: var(--blue); }

/* ── Confirm modal ─────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 2500;
  background: rgba(3,5,9,0.7); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; transition: opacity 0.2s;
}
.confirm-overlay.show { opacity: 1; }
.confirm-box {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0,0,0,0.55);
  transform: scale(0.94); transition: transform 0.2s;
}
.confirm-overlay.show .confirm-box { transform: scale(1); }
.confirm-ico {
  width: 52px; height: 52px; border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800;
  background: var(--blue-dim); color: var(--blue);
  border: 1px solid rgba(61,139,255,0.35);
}
.confirm-ico.danger {
  background: var(--red-dim); color: var(--red);
  border-color: rgba(255,77,106,0.35);
}
.confirm-box h3 { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.01em; }
.confirm-box p { color: var(--muted); font-size: 0.85rem; line-height: 1.55; margin-bottom: 22px; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
