/* ── Design tokens ────────────────────────────────────────────
   To restyle, change values here only.
   ──────────────────────────────────────────────────────────── */
:root {
  /* Page & surface backgrounds */
  --bg-page:        #030712;
  --bg-subtle:      #0d1117;
  --bg-input:       #111827;
  --surface:        #1f2937;
  --surface-high:   #374151;
  --surface-active: #1e3a5f;

  /* Borders */
  --border:         #374151;
  --border-subtle:  #1f2937;
  --border-accent:  #3b82f6;
  --border-focus:   #2563eb;

  /* Primary action */
  --accent:         #1d4ed8;
  --accent-hover:   #2563eb;

  /* Text hierarchy */
  --text-bright:    #f3f4f6;
  --text-strong:    #e5e7eb;
  --text-base:      #d1d5db;
  --text-secondary: #9ca3af;
  --text-dim:       #6b7280;
  --text-placeholder: #4b5563;
  --text-label:     #374151;

  /* Accent & status text */
  --text-accent:    #60a5fa;
  --text-accent-lt: #93c5fd;
  --text-error:     #f87171;
  --text-error-lt:  #fca5a5;

  /* Semantic indicator tokens — one meaning per color, used everywhere */
  --bull:    #4ade80;   /* bullish direction */
  --bear:    #f87171;   /* bearish direction */
  --fresh:   #fbbf24;   /* recent flip / recency highlight */
  --forming: #94a3b8;   /* uncertain / not yet confirmed */
  --crypto:  #60a5fa;   /* crypto asset type marker */
}

/* ── Semantic indicator classes ──────────────────────────── */
.ind-bull    { color: var(--bull); }
.ind-bear    { color: var(--bear); }
.ind-fresh   { color: var(--fresh); }
.ind-forming { color: var(--forming); }

/* Bar fills (modal score bar) — same semantic tokens as text indicators */
.bar-bull { background: var(--bull); }
.bar-bear { background: var(--bear); }

/* Signal row: left border + subtle tint encode direction + strength */
.row-entry { border-left: 2px solid var(--bull);  background: rgba(74, 222, 128, 0.05); }
.row-exit  { border-left: 2px solid var(--bear);  background: rgba(248, 113, 113, 0.05); }
.row-watch { border-left: 2px solid var(--fresh); background: rgba(251, 191, 36, 0.04); }
.row-plain { border-left: 2px solid transparent; }

/* Signal badge pills */
.sig-entry { color: var(--bull);  background: rgba(74, 222, 128, 0.12); }
.sig-exit  { color: var(--bear);  background: rgba(248, 113, 113, 0.12); }
.sig-watch { color: var(--fresh); background: rgba(251, 191, 36, 0.10); }

/* Crypto asset type marker */
.type-crypto { color: var(--crypto); font-size: 0.8em; vertical-align: super; line-height: 0; }

/* Supertrend ladder (ST column): one dot per rung, low→high timeframe.
   Container tint reflects the stateless traffic-light badge. */
.st-ladder {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 5px;
}
.st-ladder-risk_on  { background: rgba(74, 222, 128, 0.10); }
.st-ladder-risk_off { background: rgba(248, 113, 113, 0.10); }
.st-ladder-neutral  { background: transparent; }

.st-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--forming);
}
.st-dot-bull   { background: var(--bull); }
.st-dot-bear   { background: var(--bear); }
.st-dot-nodata { background: var(--surface-high); }
.st-dot-fresh  { box-shadow: 0 0 0 2px var(--fresh); }

/* ── Base ─────────────────────────────────────────────────── */
body { background: var(--bg-page); font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
[x-cloak] { display: none !important; }

/* Keyboard navigation: visible focus ring on anything focusable.
   Mouse clicks don't trigger :focus-visible, so pointer UX is unchanged. */
:focus-visible { outline: 2px solid var(--border-accent); outline-offset: 1px; border-radius: 2px; }

/* ── Filter / nav buttons ─────────────────────────────────── */
.filter-btn {
  padding: 2px 8px; border-radius: 4px; font-size: 11px;
  background: var(--surface); color: var(--text-dim); cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
}
.filter-btn:hover { background: var(--surface-high); color: var(--text-base); }
.filter-btn.active { background: var(--surface-active); color: var(--text-accent); border-color: var(--border-accent); }

.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

th { font-size: 10px; letter-spacing: 0.08em; }

/* ── Form inputs ──────────────────────────────────────────── */
input, select { background: var(--bg-input); }

.form-input {
  border-radius: 4px; padding: 8px 10px;
  font-size: 12px; color: var(--text-strong);
  background: var(--surface); border: 1px solid var(--border); outline: none;
}
.form-input:focus { border-color: var(--border-focus); }
.form-input::placeholder { color: var(--text-placeholder); }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }

.input-sm {
  border-radius: 4px; padding: 6px 8px;
  font-size: 12px; color: var(--text-strong);
  border: 1px solid var(--border); outline: none;
}
.input-sm:focus { border-color: var(--border-focus); }

/* ── Action buttons ───────────────────────────────────────── */
.btn-primary {
  font-size: 12px; padding: 6px 12px; border-radius: 4px;
  background: var(--accent); color: white; cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-primary-lg {
  font-size: 12px; padding: 8px 16px; font-weight: 500; border-radius: 4px;
  background: var(--accent); color: white; cursor: pointer; transition: background 0.15s;
}
.btn-primary-lg:hover { background: var(--accent-hover); }

.btn-secondary {
  font-size: 12px; padding: 6px 12px; border-radius: 4px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer; transition: background 0.15s;
}
.btn-secondary:hover { background: var(--surface-high); }

.btn-secondary-lg {
  font-size: 12px; padding: 8px 16px; border-radius: 4px;
  background: var(--surface); color: var(--text-secondary); cursor: pointer; transition: background 0.15s;
}
.btn-secondary-lg:hover { background: var(--surface-high); }

.btn-danger { color: var(--text-error); }
.btn-danger:hover { color: var(--text-error-lt); }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay { background: rgba(0,0,0,0.88); backdrop-filter: blur(4px); }

/* ── Tab buttons ──────────────────────────────────────────── */
.tab-btn { padding: 4px 16px; font-size: 12px; border-radius: 4px; cursor: pointer; transition: all 0.15s; }
.tab-btn.active { background: var(--accent); color: white; }
.tab-btn:not(.active) { color: var(--text-dim); }
.tab-btn:not(.active):hover { color: var(--text-secondary); }

.list-tab { padding: 3px 10px; font-size: 11px; border-radius: 4px; cursor: pointer;
  transition: all 0.15s; border: 1px solid transparent; }
.list-tab.active { background: var(--surface-active); color: var(--text-accent-lt); border-color: var(--border-accent); }
.list-tab:not(.active) { color: var(--text-dim); background: var(--surface); }
.list-tab:not(.active):hover { color: var(--text-secondary); background: var(--surface-high); }

.nav-tab {
  display: flex; align-items: center; height: 100%;
  padding: 0 14px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
  white-space: nowrap; color: var(--text-dim);
  border-bottom: 2px solid transparent;
  background: transparent; border-radius: 0;
}
.nav-tab:hover { color: var(--text-secondary); }
.nav-tab.active { color: var(--text-bright); border-bottom-color: var(--border-accent); }

.mobile-nav-btn {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 6px; font-size: 13px;
  color: var(--text-dim); background: transparent; cursor: pointer;
  border: none; transition: all 0.15s;
}
.mobile-nav-btn:hover { background: var(--surface-high); color: var(--text-base); }

/* ── Filter bar container ──────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center;
  background: var(--bg-subtle); border: 1px solid var(--border-subtle); border-radius: 4px;
  padding: 5px 10px;
}
.filter-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.07em;
  color: var(--text-label); text-transform: uppercase; white-space: nowrap;
}

/* ── Discovery table ──────────────────────────────────────── */
.signal-row { cursor: pointer; }
.signal-row:hover td { background: rgba(255,255,255,0.04); }

/* Sortable column header */
.th-sort {
  text-align: left; padding: 8px 12px 8px 0;
  cursor: pointer; user-select: none;
  transition: color 0.15s;
}
.th-sort:hover { color: var(--text-secondary); }

/* Floating action buttons */
.fab {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.fab-up { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.fab-up:hover { background: var(--surface-high); border-color: var(--text-dim); color: white; }
.fab-add { background: var(--accent); border: 1px solid var(--accent-hover); color: white; font-weight: 500; }
.fab-add:hover { background: var(--accent-hover); }

/* ── Misc ─────────────────────────────────────────────────── */
.err { color: var(--text-error); font-size: 11px; margin-top: 4px; }

/* Hide scrollbar on nav while preserving scroll */
.nav-scroll { scrollbar-width: none; -ms-overflow-style: none; }
.nav-scroll::-webkit-scrollbar { display: none; }

.min-h-60vh { min-height: 60vh; }

/* ── AI report markdown ───────────────────────────────────── */
.prose-report { color: var(--text-base); font-size: 12px; max-width: none; }
.prose-report h1 { color: white; font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.prose-report h2 { color: var(--text-strong); font-size: 14px; font-weight: 500; margin-top: 20px; margin-bottom: 8px; }
.prose-report h3 { color: var(--text-base); font-size: 14px; font-weight: 500; margin-top: 16px; margin-bottom: 4px; }
.prose-report p { color: var(--text-secondary); font-size: 12px; line-height: 1.625; margin-bottom: 8px; }
.prose-report ul { font-size: 12px; color: var(--text-secondary); padding-left: 16px; margin-bottom: 8px; }
.prose-report li { margin-bottom: 2px; }
.prose-report strong { color: var(--text-strong); }
.prose-report table { font-size: 12px; width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.prose-report th { text-align: left; color: var(--text-dim); border-bottom: 1px solid var(--border-subtle); padding-bottom: 4px; padding-right: 16px; }
.prose-report td { color: var(--text-secondary); border-bottom: 1px solid var(--bg-input); padding: 4px 16px 4px 0; }
.prose-report hr { border-color: var(--border-subtle); margin: 16px 0; }
.prose-report code { color: var(--text-accent); font-size: 12px; }

@media (max-width: 639px) {
  .asset-name { max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  .nav-tab { padding: 0 10px; }
  .filter-btn { padding: 5px 10px; }
}
