/* === Futuristic Ops Console — design system === */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-0: #06070d; --bg-1: #0a0e1a; --bg-2: #0f1626; --bg-3: #1a2236;
  --text: #e6edf3; --muted: #7d8590; --dim: #4b5366;
  --line: rgba(125, 133, 144, 0.14); --line-strong: rgba(125, 133, 144, 0.28);
  --cyan: #22d3ee; --cyan-bright: #67e8f9; --cyan-glow: rgba(34, 211, 238, 0.35);
  --magenta: #ec4899; --magenta-glow: rgba(236, 72, 153, 0.35);
  --lime: #a3e635; --lime-glow: rgba(163, 230, 53, 0.30);
  --amber: #f59e0b; --danger: #ef4444;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text); font-family: var(--font-body); min-height: 100vh; }

.page {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  padding: 1.8rem 4rem 3rem 4rem;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}
.page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(800px 600px at 90% 10%, rgba(34, 211, 238, 0.08), transparent 60%),
    radial-gradient(700px 500px at 10% 95%, rgba(236, 72, 153, 0.07), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.page > * { position: relative; z-index: 2; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
h1 {
  font-size: 2.8rem;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 60%, var(--cyan-bright) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 1.2rem;
}
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--cyan-bright); text-transform: uppercase; letter-spacing: 0.08em; }

strong { color: #fff; font-weight: 600; }

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85em;
  background: rgba(15, 22, 38, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  margin: 0.8rem 0;
}
th {
  background: rgba(34, 211, 238, 0.08);
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
  padding: 0.6rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan-bright);
}
td { border-bottom: 1px solid var(--line); padding: 0.6rem 0.9rem; font-family: var(--font-mono); font-size: 0.95em; }
tr:last-child td { border-bottom: none; }
tr.total-row td { background: rgba(34, 211, 238, 0.06); font-weight: 600; }
tr.total-row td:first-child { color: var(--cyan-bright); text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.78em; }

/* Eyebrow */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cyan-bright);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.eyebrow::before { content: ''; width: 28px; height: 1px; background: var(--cyan); }

.kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* HUD card */
.hud {
  background: linear-gradient(180deg, rgba(15, 22, 38, 0.7) 0%, rgba(10, 14, 26, 0.6) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  position: relative;
  margin-bottom: 1.4rem;
}
.hud::before, .hud::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--cyan);
}
.hud::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.hud::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.hud-magenta::before, .hud-magenta::after { border-color: var(--magenta); }
.hud-lime::before, .hud-lime::after { border-color: var(--lime); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid currentColor;
}
.badge.ok { color: var(--lime); }
.badge.warn { color: var(--amber); }
.badge.bad { color: var(--danger); }
.badge.info { color: var(--cyan); }
.badge::before {
  content: '';
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 2s ease-in-out infinite;
}
.badge.static::before { animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Big stat */
.stat {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 4.5rem;
  line-height: 0.9;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--cyan-bright) 0%, var(--cyan) 50%, var(--magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px var(--cyan-glow));
}

/* Color utilities */
.cyan { color: var(--cyan-bright); }
.magenta { color: var(--magenta); }
.lime { color: var(--lime); }
.amber { color: var(--amber); }
.danger { color: var(--danger); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--font-mono); }

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  margin: 1.2rem 0;
}

/* ===== App-specific ===== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  gap: 2rem;
  flex-wrap: wrap;
}
.app-header .stat { margin: 0.4rem 0 0.3rem 0; }
.header-actions { display: flex; gap: 0.6rem; align-items: center; }

/* Buttons */
button, .btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cyan-bright);
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.45);
  padding: 0.55rem 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
button:hover, .btn:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: var(--cyan-bright);
  box-shadow: 0 0 12px var(--cyan-glow);
}
button.btn-magenta { color: var(--magenta); background: rgba(236,72,153,0.08); border-color: rgba(236,72,153,0.45); }
button.btn-magenta:hover { background: rgba(236,72,153,0.18); border-color: var(--magenta); box-shadow: 0 0 12px var(--magenta-glow); }
button.btn-danger { color: var(--danger); background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.45); }
button.btn-danger:hover { background: rgba(239,68,68,0.18); }
button.btn-quiet { background: transparent; border-color: var(--line-strong); color: var(--muted); }
button.btn-quiet:hover { color: var(--cyan-bright); border-color: var(--cyan); background: rgba(34, 211, 238, 0.05); }
button.btn-tiny { padding: 0.25rem 0.5rem; font-size: 0.62rem; }

/* Inputs */
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(6, 7, 13, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  width: 100%;
  transition: all 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12), 0 0 12px var(--cyan-glow);
}
label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  display: block;
  margin-bottom: 0.3rem;
}

/* Gate */
.gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate-card {
  width: min(420px, 90vw);
  padding: 2rem;
}
.gate-card h1 { margin-bottom: 0.4rem; }
.gate-card form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1.2rem; }

/* Coin header row inside hud */
.coin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.coin-head .lhs { display: flex; flex-direction: column; gap: 0.35rem; }
.coin-head h2 { font-size: 1.8rem; }
.coin-head .rhs { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }

.price-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
}
.price-row input { width: 12ch; padding: 0.35rem 0.55rem; font-size: 0.85rem; }
.price-row .updated { font-size: 0.7rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }

.wallet-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.8rem 0 0.3rem 0;
  flex-wrap: wrap;
}
.wallet-row input { width: 18ch; padding: 0.3rem 0.5rem; font-size: 0.82rem; }
.wallet-row .wallet-val { color: var(--text); }

/* Tx actions */
.tx-actions { display: flex; gap: 0.5rem; margin: 0.6rem 0 0 0; flex-wrap: wrap; }

/* Watchlist strip */
.watchlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem;
  margin: 0.6rem 0 2rem 0;
}
.watch-chip {
  background: rgba(15, 22, 38, 0.55);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}
.watch-chip .sym { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600; color: var(--cyan-bright); }
.watch-chip .name { font-size: 0.7rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
.watch-chip .price {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text);
}
.watch-chip .price.empty { color: var(--dim); }
.watch-chip input { font-size: 0.82rem; padding: 0.3rem 0.5rem; }
.watch-chip .chip-actions { display: flex; gap: 0.35rem; margin-top: 0.3rem; }

.watchlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.6rem 0 0.4rem 0;
}

/* Modals */
dialog {
  background: linear-gradient(180deg, rgba(15, 22, 38, 0.95) 0%, rgba(10, 14, 26, 0.95) 100%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 1.6rem;
  color: var(--text);
  width: min(480px, 92vw);
  position: relative;
}
dialog::before, dialog::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--cyan);
}
dialog::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
dialog::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }
dialog::backdrop { background: rgba(6, 7, 13, 0.75); backdrop-filter: blur(4px); }
dialog form { display: flex; flex-direction: column; gap: 0.85rem; }
dialog h3 { margin-bottom: 0.3rem; }
dialog .modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.6rem; }
dialog .preview {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
}
dialog .preview .row { display: flex; justify-content: space-between; gap: 1rem; }
dialog .preview .row .v { color: var(--cyan-bright); }

/* Lot owner cell */
.owner-cell { color: var(--cyan-bright); font-weight: 600; }

/* Type badges in tx table */
.tx-type-buy { color: var(--cyan); }
.tx-type-sell { color: var(--magenta); }

/* P&L colors */
.pnl-pos { color: var(--lime); }
.pnl-neg { color: var(--danger); }
.pnl-zero { color: var(--muted); }

/* Empty / pending */
.empty-state {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--dim);
  text-align: center;
  padding: 1.2rem;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  margin: 0.6rem 0;
}

/* Narrow viewport tweaks */
@media (max-width: 760px) {
  .page { padding: 1rem; }
  .stat { font-size: 3rem; }
  .app-header { gap: 1rem; }
  .coin-head h2 { font-size: 1.4rem; }
  table { font-size: 0.78em; }
  th, td { padding: 0.45rem 0.55rem; }
  .hud { padding: 1rem; }
  .header-actions { width: 100%; }
}

/* Inline edit pencil */
.icon-btn {
  background: transparent;
  border: none;
  padding: 0.15rem 0.35rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.icon-btn:hover { color: var(--cyan-bright); background: rgba(34, 211, 238, 0.1); border: none; box-shadow: none; }

/* Inline price chart inside holding cards */
.chart-slot {
  margin: 0.4rem 0 0.8rem 0;
  padding: 0.7rem 0.9rem;
  background: rgba(6, 7, 13, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.chart-loading,
.chart-error {
  text-align: center;
  padding: 1.4rem 0;
  font-family: var(--font-mono);
}
.chart-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.chart-delta {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.chart-range {
  margin-left: auto;
  font-size: 0.62rem;
}
.chart-svg {
  width: 100%;
  height: 140px;
  display: block;
}
.chart-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
  font-size: 0.6rem;
}

/* Inline info icons (click to jump into Learn modal) */
button.info-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  padding: 0;
  margin: 0 0 0 0.3em;
  border: 1px solid rgba(34, 211, 238, 0.55);
  border-radius: 50%;
  background: transparent;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72em;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1em;
  text-align: center;
  cursor: pointer;
  vertical-align: middle;
  font-style: italic;
  transition: all 0.12s ease;
}
button.info-icon:hover {
  background: rgba(34, 211, 238, 0.18);
  color: var(--cyan-bright);
  border-color: var(--cyan-bright);
  box-shadow: 0 0 8px var(--cyan-glow);
}

/* Learn modal */
.learn-modal {
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) rgba(15, 22, 38, 0.5);
}
.learn-modal::-webkit-scrollbar { width: 8px; }
.learn-modal::-webkit-scrollbar-track { background: rgba(15, 22, 38, 0.5); }
.learn-modal::-webkit-scrollbar-thumb { background: var(--cyan); border-radius: 4px; }

.learn-modal section {
  margin: 1rem 0;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.learn-modal section:last-of-type { border-bottom: none; }

.learn-term {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--cyan-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}
.learn-term.magenta { color: var(--magenta); }
.learn-term.lime { color: var(--lime); }
.learn-term.cyan { color: var(--cyan-bright); }

.learn-modal p {
  margin: 0.3rem 0 0.5rem 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}
.learn-modal ul {
  margin: 0.4rem 0;
}
.learn-modal ul li {
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.4rem;
}
.learn-modal a {
  display: inline-block;
  color: var(--cyan);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin: 0.2rem 0.8rem 0.2rem 0;
  padding-bottom: 1px;
  border-bottom: 1px dashed rgba(34, 211, 238, 0.45);
  transition: all 0.15s ease;
}
.learn-modal a:hover {
  color: var(--cyan-bright);
  border-bottom-style: solid;
  border-bottom-color: var(--cyan-bright);
}
.learn-modal code {
  background: rgba(34, 211, 238, 0.10);
  color: var(--cyan-bright);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid rgba(34, 211, 238, 0.20);
  font-family: var(--font-mono);
}

/* Footer status line */
.statusline {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.statusline .left::before { content: '◉ '; color: var(--cyan); }
