:root {
  --bg: #071018;
  --bg-2: #0c1824;
  --panel: #10202d;
  --line: #1d3344;
  --text: #e7f1f6;
  --muted: #8aa0b0;
  --accent: #3ee0c5;
  --accent-2: #e4b84a;
  --loss: #ff6b7a;
  --win: #3ee0c5;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Instrument Sans", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(62, 224, 197, 0.08), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(228, 184, 74, 0.08), transparent 45%),
    var(--bg);
  color: var(--text);
}

.top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 220px; }
.brand strong { display: block; letter-spacing: 0.02em; }
.brand span { color: var(--muted); font-size: 12px; }
.mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent-2), var(--accent));
  box-shadow: 0 0 24px rgba(62, 224, 197, 0.35);
}
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font: inherit;
}
.tab.active { background: var(--panel); color: var(--text); }
.health {
  margin-left: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}
.health.ok { color: var(--accent); border-color: rgba(62, 224, 197, 0.35); }

main {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 73px);
}
.panel {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(16, 32, 45, 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
input, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0; min-height: 3.2em; }
details { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
details > * + * { margin-top: 8px; }
summary { cursor: pointer; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button {
  font: inherit; cursor: pointer; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  padding: 10px 12px;
}
button.primary {
  background: linear-gradient(180deg, #4aeccf, #2bc4ab);
  color: #04241f; border: 0; font-weight: 600; flex: 1;
}
button.primary:disabled { opacity: 0.55; cursor: wait; }
.disclaimer { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: auto; }
.workspace { padding: 20px 24px 40px; }
.note { min-height: 1.2em; color: var(--accent-2); font-size: 13px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.metric b { display: block; font-family: "IBM Plex Mono", monospace; font-size: 18px; margin-top: 4px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric.up b { color: var(--win); }
.metric.down b { color: var(--loss); }
.charts { display: grid; gap: 12px; margin-bottom: 16px; }
figure {
  margin: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 12px 12px 8px; box-shadow: var(--shadow);
}
figcaption { color: var(--muted); font-size: 12px; margin: 0 4px 8px; }
canvas { width: 100%; height: auto; display: block; }
.table-wrap {
  overflow: auto; max-height: 360px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--panel);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: #132433; }
td { font-family: "IBM Plex Mono", monospace; }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.hidden { display: none !important; }
.compare {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 16px;
}
.compare th, .compare td { padding: 12px; border-bottom: 1px solid var(--line); }
.compare td:first-child { font-weight: 600; }

.call-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.call {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.call header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.call .sym { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.call .px { font-family: "IBM Plex Mono", monospace; margin: 8px 0 6px; }
.call .reason { color: var(--muted); font-size: 13px; line-height: 1.4; margin: 0; }
.call .conf { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
}
.call.buy { border-color: rgba(62, 224, 197, 0.45); }
.call.sell { border-color: rgba(255, 107, 122, 0.45); }
.call.buy .badge { background: rgba(62, 224, 197, 0.16); color: var(--win); }
.call.sell .badge { background: rgba(255, 107, 122, 0.16); color: var(--loss); }
.call.hold .badge { background: rgba(138, 160, 176, 0.12); color: var(--muted); }
.lessons-panel h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 500; }
.lessons-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lessons-panel li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}
.lessons-panel li.avoid { border-color: rgba(255, 107, 122, 0.35); }
.lessons-panel li.repeat { border-color: rgba(62, 224, 197, 0.35); }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 20% 0%, rgba(62, 224, 197, 0.14), transparent 55%),
    rgba(7, 16, 24, 0.92);
  backdrop-filter: blur(10px);
}
.auth-gate[hidden] { display: none !important; }
.auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(16, 32, 45, 0.95);
  box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 8px; }
.auth-card strong { font-size: 22px; letter-spacing: 0.02em; }
.auth-hint { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0; }
.auth-error { color: var(--loss); font-size: 13px; margin: 0; min-height: 1.2em; }
.scope-toggle {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.scope-toggle legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.scope-toggle .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  font-size: 13px;
  cursor: pointer;
}
.scope-toggle .chip:has(input:checked) {
  border-color: rgba(62, 224, 197, 0.45);
  color: var(--win);
}
.crypto-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.crypto-chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: rgba(16, 32, 45, 0.55);
}
.crypto-chart-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.crypto-chart-card canvas {
  width: 100%;
  height: 120px;
  display: block;
}
.settings-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
}
.settings-board h2 { margin: 0; font-size: 22px; }
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 32, 45, 0.72);
}
button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
}
button.ghost:hover { color: var(--text); border-color: rgba(62,224,197,0.35); }

.chat-dock {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: none;
}
.chat-dock > * { pointer-events: auto; }
.chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, rgba(18, 42, 58, 0.96), rgba(10, 24, 34, 0.98));
  color: #e8f4f1;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font: inherit;
}
.chat-launcher:hover { border-color: rgba(62, 224, 197, 0.45); }
.chat-launcher-label { font-weight: 650; letter-spacing: 0.01em; }
.chat-launcher-hint {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.72;
}
.chat-panel {
  width: min(420px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at top right, rgba(62, 224, 197, 0.12), transparent 40%),
    linear-gradient(160deg, rgba(12, 28, 38, 0.98), rgba(8, 18, 26, 0.98));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}
.chat-panel.hidden { display: none; }
.chat-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.chat-panel-head strong {
  display: block;
  font-size: 1rem;
}
.chat-panel-head p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  opacity: 0.7;
}
.chat-close { padding: 0.25rem 0.55rem; }
.chat-log {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-right: 0.2rem;
  min-height: 0;
}
.chat-bubble {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.92rem;
}
.chat-bubble.user {
  align-self: flex-end;
  background: rgba(62, 224, 197, 0.12);
  border-color: rgba(62, 224, 197, 0.28);
}
.chat-bubble.assistant { align-self: flex-start; }
.chat-text { white-space: pre-wrap; }
.chat-recs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.chat-rec {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.chat-rec.long { color: var(--win); border-color: rgba(62, 224, 197, 0.4); }
.chat-rec.short { color: var(--loss); border-color: rgba(255, 107, 122, 0.4); }
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}
.chat-action {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(62, 224, 197, 0.35);
  background: rgba(62, 224, 197, 0.08);
  color: inherit;
  cursor: pointer;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chat-chip {
  font: inherit;
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.chat-chip:hover, .chat-action:hover {
  border-color: rgba(62, 224, 197, 0.5);
}
.chat-form {
  display: flex;
  gap: 0.45rem;
}
.chat-form input { flex: 1; }
.chat-form .primary { flex: 0; min-width: 84px; }
@media (max-width: 720px) {
  .chat-dock { right: 0.75rem; bottom: 0.75rem; left: 0.75rem; align-items: stretch; }
  .chat-launcher { justify-content: center; }
  .chat-panel { width: 100%; height: min(70vh, 560px); }
}

@media (max-width: 960px) {
  main { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .top { flex-wrap: wrap; padding-top: calc(12px + env(safe-area-inset-top)); }
  .tabs { flex-wrap: wrap; }
  button, input, select { min-height: 44px; font-size: 16px; }
  .call-grid { grid-template-columns: 1fr; }
}


.tracker-board { display: grid; gap: 18px; }
.tracker-header { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; }
.tracker-header h2 { margin: 0; font-size: 1.45rem; }
.tracker-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tracker-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tracker-stat { padding: 12px 14px; border: 1px solid rgba(255,255,255,0.08); background: rgba(12,18,28,0.55); }
.tracker-stat span { display: block; color: #9aa7b8; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tracker-stat strong { font-size: 1.2rem; }
.tracker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tracker-card { border: 1px solid rgba(255,255,255,0.08); background: rgba(10,16,24,0.72); padding: 10px; display: grid; gap: 8px; }
.tracker-card header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.tracker-card canvas { width: 100%; height: 110px; background: rgba(0,0,0,0.25); }
.tracker-card .action-BUY { color: #3ee0c5; }
.tracker-card .action-SELL { color: #ff6b7a; }
.tracker-card .action-HOLD { color: #e4b84a; }
.paper-book { display: grid; gap: 8px; }
.paper-row { display: grid; grid-template-columns: 1.1fr 0.7fr 0.8fr 0.8fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.92rem; }
.team-admin { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.team-form { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.team-list { display: grid; gap: 8px; margin-top: 12px; }
.team-row { display: grid; grid-template-columns: 1.4fr 0.6fr 0.8fr auto; gap: 8px; align-items: center; padding: 10px; border: 1px solid rgba(255,255,255,0.08); background: rgba(12,18,28,0.45); }
@media (max-width: 720px) {
  .paper-row, .team-row { grid-template-columns: 1fr 1fr; }
}

.pelosi-rec { border: 1px solid rgba(255,255,255,0.08); padding: 12px; background: rgba(10,16,24,0.7); display: grid; gap: 6px; }
.pelosi-rec.BUY { border-color: rgba(62,224,197,0.45); }
.pelosi-rec.SELL { border-color: rgba(255,107,122,0.45); }
.pelosi-rec.HOLD { border-color: rgba(228,184,74,0.35); }
.pelosi-rec .reasons { color: #9aa7b8; font-size: 0.86rem; }
