/* 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); }

/* =========================================================
   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; }

.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);
}

.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 */
@media (max-width: 680px) {
  .chat-sidebar { display: none; }
  .topbar-nav a { padding: 0.4rem 0.55rem; font-size: 0.82rem; }
  .topbar-title .tenant-tag { display: none; }
  .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; }

/* =========================================================
   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; }
.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;
  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;
  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 .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-muted);
  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-muted);
  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-muted);
  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-muted);
  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; }

/* 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-muted);
  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-muted);
  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); }

/* 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; }
}
