/* Joseph v2 — Binance Pro Trader Theme
   Ultra-dark surfaces, gold accents, sharp edges.
   Professional trading terminal aesthetic.
*/

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

:root {
  /* surfaces — Binance Pro darks */
  --bg: #0B0E11;
  --bg-raised: #1E2329;
  --bg-sunk: #0B0E11;
  --card: #181A20;
  --card-hover: #2B3139;
  --border: #2B3139;
  --border-accent: #3A3F47;

  /* text */
  --text: #EAECEF;
  --text-dim: #848E9C;
  --text-fade: #5E6673;

  /* accent — Binance gold */
  --accent: #F0B90B;
  --accent-strong: #FCD535;
  --accent-fade: rgba(240, 185, 11, 0.10);

  /* semantic — trading green/red */
  --ok: #0ECB81;
  --ok-fade: rgba(14, 203, 129, 0.10);
  --warn: #F0B90B;
  --warn-fade: rgba(240, 185, 11, 0.10);
  --err: #F6465D;
  --err-fade: rgba(246, 70, 93, 0.10);
  --info: #1E9CF4;

  /* shape — sharper */
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 1px rgba(0, 0, 0, 0.5);
  --glow-accent: 0 0 20px rgba(240, 185, 11, 0.06);

  /* motion */
  --t: 160ms cubic-bezier(0.4, 0, 0.2, 1);

  /* type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', "SF Mono", Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; color: var(--text-dim); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

.muted { color: var(--text-fade); font-size: 0.9rem; }

.inline-form { display: inline; margin: 0; }

/* --- Buttons --- */

.btn, .btn-ghost, .btn-primary {
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--t);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.btn:hover {
  background: var(--card-hover);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(240, 185, 11, 0.08);
}
.btn-primary {
  background: var(--accent);
  color: #0B0E11;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  box-shadow: 0 0 16px rgba(240, 185, 11, 0.2);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); background: var(--card); }
.btn-block { width: 100%; display: block; }

/* --- Alerts --- */

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.9rem;
}
.alert-error { background: var(--err-fade); border-color: var(--err); color: #fca5a5; }

/* --- Badges & pills --- */

.badge-dry {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--accent);
  color: #0B0E11;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pill.ok { color: var(--ok); background: var(--ok-fade); border-color: rgba(14, 203, 129, 0.25); }
.pill.warn { color: var(--accent); background: var(--warn-fade); border-color: rgba(240, 185, 11, 0.25); }
.pill.err { color: var(--err); background: var(--err-fade); border-color: rgba(246, 70, 93, 0.25); }
.pill.dim { color: var(--text-dim); background: rgba(132, 142, 156, 0.08); border-color: rgba(132, 142, 156, 0.2); }

/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 185, 11, 0.06), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(14, 203, 129, 0.03), transparent 40%),
    var(--bg);
}

.login-shell { width: 100%; max-width: 400px; }

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.login-title {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.login-subtitle { color: var(--text-dim); margin-bottom: 1.5rem; font-size: 0.9rem; }

.login-form { display: flex; flex-direction: column; gap: 1.5rem; }

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.login-form input,
.login-form select {
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  color: var(--text);
  width: 100%;
  transition: border-color var(--t), box-shadow var(--t);
}
.login-form input:focus,
.login-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fade);
}

.login-footer {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-fade);
  text-align: center;
}

/* =========================================================
   TOPBAR (dashboard + chat)
   ========================================================= */

.topbar {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.topbar-inner {
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.agent-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #0B0E11;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(240, 185, 11, 0.15);
}

.agent-name { font-weight: 600; font-size: 1rem; color: var(--text); }
.tenant-tag {
  font-size: 0.72rem;
  color: var(--text-fade);
  font-family: var(--font-mono);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.topbar-nav a {
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--t);
}
.topbar-nav a:hover { color: var(--text); background: var(--card); }
.topbar-nav a.nav-active { color: var(--accent); background: var(--accent-fade); }

/* =========================================================
   DASHBOARD
   ========================================================= */

.dashboard {
  padding: 2rem 2rem;
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .dashboard { grid-template-columns: 1fr; }
  .dashboard > .card:first-child { grid-column: 1 / -1; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color var(--t), box-shadow var(--t);
}
.card:hover {
  border-color: var(--border-accent);
}
.card h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
}
.card-subtitle {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-dim);
}

.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
}
.kv-grid .k {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.kv-grid .v { color: var(--text); word-break: break-all; }

.jobs-list, .trades-list, .doc-list { display: grid; gap: 0.5rem; }

.job-row, .trade-row, .doc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  transition: border-color var(--t);
}
.job-row:hover, .doc-row:hover {
  border-color: var(--border-accent);
}
.job-row .job-name, .trade-row .trade-time, .doc-row .doc-name {
  font-weight: 500;
  color: var(--text);
}
.job-row .job-meta, .trade-row .trade-meta, .doc-row .doc-meta {
  color: var(--text-fade);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}
.doc-row { cursor: pointer; transition: background var(--t), border-color var(--t); }
.doc-row:hover { background: var(--card-hover); }

.cost-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.cost-summary .cost-big {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}
.cost-summary .cost-label { color: var(--text-dim); font-size: 0.85rem; }

/* DCA Budget settings */
.card-hint { color: var(--text-dim); font-size: 0.82rem; margin: -0.25rem 0 1rem; }
.dca-settings { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.dca-field { flex: 1; min-width: 140px; }
.dca-field label { display: block; font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.35rem; font-weight: 500; }
.label-hint { font-size: 0.72rem; font-weight: 400; opacity: 0.6; }
.label-fear { color: var(--ok); }
.label-greed { color: var(--err); }
.input-dollar { position: relative; }
.dollar-sign {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 0.9rem; pointer-events: none;
}
.input-dollar input {
  width: 100%; padding: 0.55rem 0.7rem 0.55rem 1.5rem;
  font-family: var(--font-mono); font-size: 0.95rem;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}
.input-dollar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fade); }
.dca-actions { display: flex; align-items: center; gap: 0.75rem; min-width: 140px; padding-bottom: 1px; }
.dca-status { font-size: 0.82rem; color: var(--ok); opacity: 0; transition: opacity 0.3s; }
.dca-status.visible { opacity: 1; }
.pill-dim { background: var(--bg-raised); color: var(--text-dim); font-size: 0.72rem; }

/* Server info */
.server-info-item {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.6rem 0;
}
.server-info-label { color: var(--text-dim); font-size: 0.85rem; }
.server-info-value {
  font-family: var(--font-mono); font-size: 1rem; color: var(--accent);
  background: var(--bg-raised); padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  letter-spacing: 0.03em;
}
.btn-copy {
  font-size: 0.78rem; padding: 0.3rem 0.6rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color 0.15s;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

.search-form { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.search-form input {
  flex: 1;
  font-family: var(--font);
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fade); }

.semantic-hit {
  padding: 0.75rem 0.9rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}
.semantic-hit .hit-meta { color: var(--text-fade); font-size: 0.75rem; margin-top: 0.35rem; font-family: var(--font-mono); }

/* Modal for doc viewer */
.doc-modal {
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  max-width: 800px;
  width: 95vw;
  padding: 0;
  max-height: 85vh;
  box-shadow: var(--shadow-lg);
}
.doc-modal::backdrop { background: rgba(0, 0, 0, 0.8); }
.doc-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.doc-body {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: calc(85vh - 60px);
  margin: 0;
}

/* =========================================================
   CHAT
   ========================================================= */

.chat-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.chat-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.chat-sidebar {
  width: 240px;
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  background: var(--bg-raised);
  flex-shrink: 0;
}

.conv-list { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.9rem; }
.conv-row {
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: background var(--t), color var(--t);
  border: 1px solid transparent;
}
.conv-row:hover { background: var(--card); color: var(--text); }
.conv-row.active { background: var(--accent-fade); color: var(--accent); border-color: rgba(240, 185, 11, 0.2); }
.conv-row .conv-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row .conv-time { font-size: 0.7rem; color: var(--text-fade); margin-top: 0.2rem; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-status {
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-fade);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
}
.ws-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-fade);
}
.ws-dot[data-state="connecting"] { background: var(--warn); animation: pulse 1.3s ease-in-out infinite; }
.ws-dot[data-state="open"] { background: var(--ok); }
.ws-dot[data-state="closed"] { background: var(--err); }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scroll-behavior: smooth;
}

.msg {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: msgIn 200ms ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #0B0E11;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.msg-assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg-system {
  align-self: center;
  background: transparent;
  color: var(--text-fade);
  font-size: 0.8rem;
  font-style: italic;
  max-width: 1600px;
  padding: 0.25rem;
}
.msg-error {
  align-self: center;
  background: var(--err-fade);
  border: 1px solid var(--err);
  color: #fca5a5;
  font-size: 0.85rem;
  max-width: 90%;
}

.msg-meta {
  font-size: 0.72rem;
  color: var(--text-fade);
  margin-top: 0.4rem;
  font-family: var(--font-mono);
}

/* Rendered Markdown content inside assistant messages */
.msg-content {
  white-space: normal;
  line-height: 1.6;
}
.msg-content h2 {
  font-size: 1.05rem;
  color: var(--accent);
  margin: 0.8rem 0 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
.msg-content h2:first-child { margin-top: 0; }
.msg-content h3 {
  font-size: 0.92rem;
  color: var(--text);
  margin: 0.6rem 0 0.3rem;
}
.msg-content p {
  margin: 0.3rem 0;
}
.msg-content ul, .msg-content ol {
  margin: 0.3rem 0;
  padding-left: 1.5rem;
}
.msg-content li {
  margin: 0.15rem 0;
}
.msg-content strong {
  color: var(--text);
  font-weight: 600;
}
.msg-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-sunk);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}
.msg-content pre {
  background: var(--bg-sunk);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.82rem;
  margin: 0.4rem 0;
}
.msg-content pre code {
  background: none;
  padding: 0;
}
.msg-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.4rem 0;
  padding: 0.3rem 0.8rem;
  color: var(--text-dim);
}

.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: thinking 1.4s infinite ease-in-out;
}
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
  align-items: flex-end;
}
.chat-form textarea {
  flex: 1;
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  color: var(--text);
  resize: none;
  max-height: 180px;
  line-height: 1.4;
  transition: border-color var(--t), box-shadow var(--t);
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fade); }

/* Mobile: collapse sidebar + topbar fixes */
@media (max-width: 680px) {
  .chat-sidebar { display: none; }
  .topbar-inner {
    padding: 0.6rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .topbar-nav {
    flex-wrap: wrap;
    gap: 0.15rem;
  }
  .topbar-nav a { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
  .topbar-nav .btn-ghost { padding: 0.35rem 0.5rem; font-size: 0.78rem; }
  .topbar-title .tenant-tag { display: none; }
  .agent-name { font-size: 0.9rem; }
  .agent-avatar { width: 32px; height: 32px; font-size: 0.95rem; }
  .msg { max-width: 92%; }
}

/* =========================================================
   TAB BAR
   ========================================================= */

.tab-bar {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 52px;
  z-index: 9;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-bar-inner {
  display: flex;
  gap: 0;
  padding: 0 2rem;
}
.tab {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.7rem 1.1rem;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color var(--t), border-color var(--t);
  letter-spacing: 0.01em;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 2rem; padding: 2rem; }

@media (max-width: 680px) {
  .tab-bar-inner { padding: 0 0.75rem; }
  .tab { padding: 0.6rem 0.75rem; font-size: 0.82rem; }
  .tab-panel.active { padding: 1rem; gap: 1rem; }
  .dashboard { padding: 1rem; gap: 1.5rem; }
  .card { padding: 1rem; }
  .card h2 { font-size: 1rem; flex-wrap: wrap; }
}

/* =========================================================
   MARKET OVERVIEW
   ========================================================= */

.chart-loading { position: relative; }
.chart-loading::after {
  content: "Loading chart\2026";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-fade);
  font-size: 0.85rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  animation: pulse-dim 1.5s ease-in-out infinite;
}
@keyframes pulse-dim {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
}

.mkt-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.mkt-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--glow-accent);
}

.mkt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.mkt-sym {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.mkt-trend {
  font-size: 1rem;
  font-weight: 700;
}
.trend-up { color: var(--ok); }
.trend-down { color: var(--err); }
.trend-flat { color: var(--text-fade); }

.mkt-price {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.mkt-change {
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-bottom: 0.6rem;
}

.mkt-rsi {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
}
.mkt-rsi-val { font-weight: 600; }
.mkt-rsi-label { font-size: 0.72rem; opacity: 0.8; }

.rsi-low {
  background: var(--ok-fade);
  color: var(--ok);
}
.rsi-high {
  background: var(--err-fade);
  color: var(--err);
}
.rsi-mid {
  background: rgba(132, 142, 156, 0.1);
  color: var(--text-dim);
}
.rsi-na {
  background: rgba(132, 142, 156, 0.06);
  color: var(--text-fade);
}

/* Fear & Greed card */
.mkt-card-fg {
  border-top: 2px solid var(--border-accent);
}

.fg-value {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.15rem;
}

.fg-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  text-transform: capitalize;
}

.fg-gauge-track {
  position: relative;
  height: 6px;
  background: var(--bg-sunk);
  border-radius: 3px;
  overflow: visible;
  margin-bottom: 0.4rem;
}
.fg-gauge-fill {
  height: 100%;
  border-radius: 3px;
  opacity: 0.35;
}
.fg-gauge-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--text);
  border: 2px solid var(--card);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.fg-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-fade);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* =========================================================
   PORTFOLIO
   ========================================================= */

.portfolio-hero {
  text-align: center;
  padding: 1.5rem 0;
}
.portfolio-value {
  font-size: 2.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: -0.02em;
}
.portfolio-pnl {
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-top: 0.35rem;
}
.pnl-pos {
  color: var(--ok);
  text-shadow: 0 0 12px rgba(14, 203, 129, 0.25);
}
.pnl-neg {
  color: var(--err);
  text-shadow: 0 0 12px rgba(246, 70, 93, 0.25);
}
.portfolio-basis {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

.asset-cards { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.asset-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.asset-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--glow-accent);
}
.asset-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.asset-sym {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
}
.asset-price { font-family: var(--font-mono); color: var(--text-dim); font-weight: 500; }
.asset-body {
  font-size: 0.88rem;
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-mono);
}
.asset-body .k { color: var(--text-fade); font-size: 0.82rem; }

.chart-container { position: relative; height: 280px; }
.chart-container-sm { height: 260px; }

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  grid-column: 1 / -1;
}
@media (max-width: 800px) {
  .chart-row { grid-template-columns: 1fr; }
}

.card-full { grid-column: 1 / -1; }

/* =========================================================
   TRADES TABLE
   ========================================================= */

.select-sm {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--t);
}
.select-sm:hover { border-color: var(--accent); }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 2px solid var(--accent);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--card);
}
.data-table td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.data-table tbody tr:nth-child(even) td {
  background: rgba(30, 35, 41, 0.4);
}
.data-table tr:hover td { background: var(--card-hover); }

/* =========================================================
   FILES
   ========================================================= */

.files-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  grid-column: 1 / -1;
}
@media (max-width: 720px) {
  .files-layout { grid-template-columns: 1fr; }
}

.file-sidebar { max-height: 70vh; overflow-y: auto; }
.file-list { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.5rem; }
.file-dir {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-top: 0.7rem;
  padding-left: 0.5rem;
  opacity: 0.7;
}
.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--t);
}
.file-row:hover, .file-row.active { background: var(--card-hover); }
.file-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 0.72rem; flex-shrink: 0; color: var(--text-fade); font-family: var(--font-mono); }

.file-editor { display: flex; flex-direction: column; min-height: 400px; }
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.editor-filename {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent);
}
.editor-actions { display: flex; gap: 0.5rem; }
.editor-textarea {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-sunk);
  color: var(--ok);
  resize: vertical;
  min-height: 350px;
  tab-size: 2;
  transition: border-color var(--t), box-shadow var(--t);
}
.editor-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fade);
}
.editor-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-dim);
}

.version-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

/* =========================================================
   SYSTEM / LOGS
   ========================================================= */

.log-viewer {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #0ECB81;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  max-height: 450px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-viewer .log-error {
  color: #F6465D !important;
  font-weight: 600;
  color: var(--ok);
}

/* =========================================================
   SCROLLBAR STYLING
   ========================================================= */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-fade);
}

/* =========================================================
   ALERT BANNER
   ========================================================= */

.alert-banner {
  margin: 0 auto 1rem;
  max-width: 1280px;
  padding: 0;
}
.alert-banner.hidden { display: none; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
}
.alert-item.severity-error {
  background: rgba(246, 70, 93, 0.12);
  border-left: 3px solid var(--err);
  color: var(--err);
}
.alert-item.severity-warning {
  background: rgba(240, 185, 11, 0.10);
  border-left: 3px solid var(--accent);
  color: var(--accent);
}
.alert-item.severity-info {
  background: rgba(30, 156, 244, 0.10);
  border-left: 3px solid var(--info);
  color: var(--info);
}
.alert-item.severity-info .alert-title {
  color: var(--text);
}
.alert-item.severity-info .alert-msg {
  color: var(--text-dim);
}
.alert-item.severity-info .kb-changelog-toggle {
  background: none;
  border: none;
  color: var(--info);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  padding: 0;
  margin-left: 0.5rem;
}
.alert-item.severity-info .kb-changelog-toggle:hover {
  color: var(--accent);
}
.kb-changelog-content {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
}
.kb-changelog-content.visible { display: block; }
.alert-item .alert-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.alert-item .alert-text {
  flex: 1;
}
.alert-item .alert-title {
  font-weight: 600;
}
.alert-item .alert-msg {
  opacity: 0.85;
  margin-left: 0.4rem;
}
.alert-item .alert-dismiss {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}
.alert-item .alert-dismiss:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
}

/* =========================================================
   STRATEGY PAGE
   ========================================================= */

.strategy-page { background: var(--bg); }

.strategy-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.strategy-hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
}
.strategy-badge {
  display: inline-block;
  background: rgba(240, 185, 11, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  border: 1px solid rgba(240, 185, 11, 0.25);
  margin-bottom: 1rem;
}
.strategy-hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
  margin: 0.75rem 0 0.6rem;
  letter-spacing: -0.02em;
}
.strategy-subtitle {
  font-size: 1.1rem;
  color: var(--text-fade);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

.strategy-body { display: flex; flex-direction: column; gap: 2.5rem; }

.strategy-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.8rem;
  position: relative;
}
.strategy-section-highlight {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(240,185,11,0.04) 0%, var(--card) 100%);
}
.strategy-section-icon {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}
.strategy-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.8rem;
}
.strategy-section p {
  color: var(--text-dim);
  line-height: 1.7;
  margin: 0 0 0.8rem;
}
.strategy-section p:last-child { margin-bottom: 0; }
.strategy-section strong { color: var(--text); }
.strategy-section em { color: var(--accent); font-style: italic; }

.strategy-section ul {
  color: var(--text-dim);
  line-height: 1.7;
  padding-left: 1.4rem;
  margin: 0.5rem 0 0;
}
.strategy-section li { margin-bottom: 0.5rem; }
.strategy-section li strong { color: var(--text); }

.strategy-section blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.8rem 1.2rem;
  margin: 1.2rem 0 0;
  color: var(--text);
  font-style: italic;
  font-size: 1.05rem;
  background: rgba(240, 185, 11, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Stats row */
.strategy-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.2rem 0 1.5rem;
}
.strategy-stat {
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 0.5rem;
}
.strategy-stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
}
.strategy-stat-label {
  font-size: 0.72rem;
  color: var(--text-fade);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}

/* Reason cards */
.strategy-reasons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}
.reason-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
}
.reason-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.reason-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* Comparison table */
.strategy-comparison { margin-top: 1rem; overflow-x: auto; }
.strategy-comparison table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.strategy-comparison th {
  text-align: left;
  padding: 0.7rem 0.9rem;
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.strategy-comparison td {
  padding: 0.75rem 0.9rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
.strategy-comparison td strong { color: var(--text); }
.strategy-comparison tr:last-child td { border-bottom: none; }
.strategy-comparison tr:hover td { background: rgba(255,255,255,0.02); }

/* Footer */
.strategy-footer {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.strategy-footer p {
  font-size: 0.82rem;
  color: var(--text-fade);
}
.strategy-footer a {
  color: var(--accent);
  text-decoration: none;
}
.strategy-footer a:hover { text-decoration: underline; }

/* How it works — system diagram (Mermaid) */
.hiw-diagram-wrap {
  max-width: 960px;
  margin: 0 auto 1.5rem;
  padding: 0 1.25rem;
}
.hiw-diagram {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 0.35rem 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.hiw-diagram .mermaid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.hiw-diagram-caption {
  margin: 0.5rem 1rem 1rem;
  font-size: 0.82rem;
  color: var(--text-fade);
  text-align: center;
  line-height: 1.45;
}
.hiw-diagram-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem 0.15rem;
  letter-spacing: -0.02em;
}
.hiw-diagram-inset {
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
}
.hiw-diagram-subtitle {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.5rem 0.15rem;
  letter-spacing: -0.01em;
}

/* F&G breakdown table */
.fg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 1rem;
}
.fg-table th {
  text-align: left;
  padding: 0.55rem 0.7rem;
  background: var(--bg-raised);
  color: var(--text);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--accent);
}
.fg-table td {
  padding: 0.55rem 0.7rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.fg-table td:first-child { font-family: var(--font); font-weight: 600; }
.fg-table tr.fg-fear td:first-child { color: var(--ok); }
.fg-table tr.fg-greed td:first-child { color: var(--err); }
.fg-table tr:last-child td { border-bottom: none; }

/* Phase cards */
.strategy-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.2rem 0 1.5rem;
}
.phase-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.2rem;
  position: relative;
}
.phase-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.4rem 0 0.4rem;
}
.phase-card p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}
.phase-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.phase-done .phase-label { color: var(--ok); }
.phase-done { border-color: rgba(14, 203, 129, 0.25); }
.phase-active .phase-label { color: var(--accent); }
.phase-active { border-color: var(--accent); background: rgba(240, 185, 11, 0.04); }
.phase-future .phase-label { color: var(--text-fade); }

/* Expansion candidate cards */
.expansion-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.candidate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.4rem;
}
.candidate-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.candidate-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.candidate-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}
.candidate-role {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
}
.candidate-card > p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 1rem;
}
.candidate-why, .candidate-risk {
  margin-top: 0.75rem;
}
.candidate-why h4, .candidate-risk h4 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem;
}
.candidate-why h4 { color: var(--ok); }
.candidate-risk h4 { color: var(--warn); }
.candidate-why ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.65;
}
.candidate-why li { margin-bottom: 0.3rem; }
.candidate-risk p {
  font-size: 0.84rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
  padding: 0.6rem 0.8rem;
  background: rgba(246, 70, 93, 0.06);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.expansion-thesis {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.4rem;
  margin-top: 1.2rem;
}
.expansion-thesis h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
.expansion-thesis p {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 0.6rem;
}
.expansion-thesis ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.65;
}
.expansion-thesis li { margin-bottom: 0.3rem; }

/* Print / PDF button */
.btn-print {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: #0B0E11;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-print:hover { opacity: 0.85; }

/* Responsive */
@media (max-width: 640px) {
  .strategy-hero h1 { font-size: 1.7rem; }
  .strategy-stats { grid-template-columns: repeat(2, 1fr); }
  .strategy-reasons { grid-template-columns: 1fr; }
  .strategy-phases { grid-template-columns: 1fr; }
  .strategy-section { padding: 1.4rem; }
  .expansion-candidates { grid-template-columns: 1fr; }
}

/* =========================================================
   PRINT / PDF EXPORT
   Clean white layout, no chrome, proper page breaks.
   Use browser Print > Save as PDF.
   ========================================================= */
@media print {
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  :root {
    --bg: #fff;
    --bg-raised: #fff;
    --card: #fff;
    --card-hover: #f5f5f5;
    --border: #ddd;
    --border-accent: #ccc;
    --text: #111;
    --text-dim: #444;
    --text-fade: #777;
    --accent: #C89B00;
    --accent-strong: #B08800;
    --accent-fade: rgba(200, 155, 0, 0.08);
    --ok: #0A9960;
    --ok-fade: rgba(10, 153, 96, 0.08);
    --warn: #C89B00;
    --warn-fade: rgba(200, 155, 0, 0.08);
    --err: #D03040;
    --err-fade: rgba(208, 48, 64, 0.08);
    --info: #1872B8;
    --shadow: none;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
    line-height: 1.5;
  }

  .no-print, .topbar, .strategy-footer a,
  .btn-print, .topbar-nav { display: none !important; }

  .strategy-page { background: #fff !important; }
  .strategy-content { max-width: 100%; padding: 0 0.5cm; }
  .strategy-hero { padding: 1cm 0 0.5cm; }
  .strategy-hero h1 { font-size: 22pt; color: #111; }
  .strategy-subtitle { color: #444; }
  .strategy-badge {
    background: #C89B00 !important;
    color: #fff !important;
  }
  .strategy-body { gap: 0.4cm; }

  .strategy-section {
    background: #fff !important;
    border: 1px solid #ddd;
    padding: 0.6cm;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .strategy-section-highlight {
    background: #fafafa !important;
    border-color: #C89B00;
  }
  .strategy-section-icon { font-size: 1.2rem; }
  .strategy-section h2 { font-size: 14pt; color: #111; }
  .strategy-section p,
  .strategy-section li { color: #333; font-size: 10.5pt; }

  .strategy-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.3cm;
  }
  .strategy-stat {
    background: #f8f8f8 !important;
    border: 1px solid #ddd;
    padding: 0.3cm;
  }
  .strategy-stat-value { color: #111 !important; font-size: 11pt; }
  .strategy-stat-label { color: #666; }

  .reason-card {
    background: #fafafa !important;
    border: 1px solid #ddd;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .reason-card h3 { color: #111; }
  .reason-card p { color: #333; }

  .strategy-reasons { grid-template-columns: repeat(2, 1fr); gap: 0.3cm; }

  .phase-card {
    background: #fafafa !important;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
  .phase-card h3 { color: #111; }
  .phase-active { border-color: #C89B00; }
  .phase-done { border-color: #0A9960; }

  .fg-table { font-size: 9.5pt; }
  .fg-table th { background: #f0f0f0 !important; color: #111; }
  .fg-table td { color: #333; border-color: #ddd; }
  .fg-table tr.fg-fear td:first-child { color: #0A9960; }
  .fg-table tr.fg-greed td:first-child { color: #D03040; }

  .strategy-comparison table { font-size: 9.5pt; }
  .strategy-comparison th { background: #f0f0f0 !important; color: #111; }
  .strategy-comparison td { color: #333; border-color: #ddd; }

  blockquote {
    border-left-color: #C89B00 !important;
    background: #faf8f0 !important;
    color: #333 !important;
  }

  .expansion-candidates { gap: 0.4cm; }
  .candidate-card {
    background: #fafafa !important;
    border: 1px solid #ddd;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .candidate-header h3 { color: #111; }
  .candidate-symbol { color: #fff !important; }
  .candidate-card > p { color: #333; }
  .candidate-why ul { color: #333; }
  .candidate-risk p {
    background: rgba(208, 48, 64, 0.05) !important;
    border-left-color: #D03040 !important;
    color: #333;
  }
  .expansion-thesis {
    background: #faf8f0 !important;
    border-color: #C89B00;
    break-inside: avoid;
  }
  .expansion-thesis h4 { color: #B08800; }
  .expansion-thesis p, .expansion-thesis li { color: #333; }

  .strategy-footer {
    border-top: 1px solid #ddd;
    padding-top: 0.3cm;
  }
  .strategy-footer p { color: #777; font-size: 9pt; }

  @page {
    size: A4;
    margin: 1.5cm 1.2cm;
  }
}

/* ====== Polymarket Arb Engine Stats ====== */

.pm-engine-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.pm-engine-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pm-hero-pnl {
  text-align: right;
}

.pm-hero-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.pm-hero-value {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ok);
}

.pm-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.pm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem 0.25rem;
}

.pm-stat-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
}

.pm-stat-lbl {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .pm-engine-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .pm-hero-pnl { text-align: left; }
  .pm-hero-value { font-size: 1.8rem; }
  .pm-stats-grid { grid-template-columns: repeat(3, 1fr); gap: 0.25rem; }
  .pm-stat { padding: 0.4rem 0.15rem; }
  .pm-stat-val { font-size: 0.95rem; }
  .pm-stat-lbl { font-size: 0.65rem; }
}

/* ====== Paper Performance Showcase ====== */
.sc-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
}
.sc-stat {
  background: var(--card);
  padding: 1.1rem 1rem;
  text-align: center;
}
.sc-stat-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.sc-stat-lbl {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.3rem;
}
.sc-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.sc-tbl th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sc-tbl td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(43,49,57,0.4);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.sc-tbl tr:last-child td { border-bottom: none; }
.sc-pnl-pos { color: var(--ok); }
.sc-pnl-neg { color: var(--err); }
@media (max-width: 768px) {
  .sc-stats-grid { grid-template-columns: repeat(2, 1fr); }
  #showcase > div > div:last-of-type { grid-template-columns: 1fr; }
  .sc-stat-val { font-size: 1rem; }
}
