/* Crypto AI Trader — semantic tokens set by themes.js (data-palette on html) */
:root,
html.dark {
  --frosted-mint: #ddffe8;
  --tuscan-sun: #f3ca40;
  --golden-orange: #f2a541;
  --tangerine-dream: #f08a4b;
  --rich-mahogany: #270700;
  --light-bronze: var(--golden-orange);
  --red-ochre: var(--tangerine-dream);
  --onyx: var(--rich-mahogany);
  --emerald: var(--frosted-mint);
  --white: #ffffff;

  --gradient-top: linear-gradient(0deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-right: linear-gradient(90deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-bottom: linear-gradient(180deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-left: linear-gradient(270deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-top-right: linear-gradient(45deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-bottom-right: linear-gradient(135deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-top-left: linear-gradient(225deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-bottom-left: linear-gradient(315deg, var(--golden-orange), var(--tangerine-dream), var(--rich-mahogany), var(--frosted-mint), #ffffff);
  --gradient-radial: radial-gradient(ellipse at 15% 0%, rgba(243, 202, 64, 0.18), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(221, 255, 232, 0.12), transparent 50%),
    radial-gradient(ellipse at 50% 50%, #2a1008, #1a0a04);

  --bg: #1a0a04;
  --surface-low: #220c06;
  --surface: #2a1008;
  --surface-high: #341408;
  --surface-highest: #3f180a;
  --on-surface: #ddffe8;
  --on-surface-variant: #f3ca40;
  --outline: #f08a4b;
  --outline-variant: #a85a28;
  --primary: #f2a541;
  --primary-container: #f08a4b;
  --on-primary: #270700;
  --secondary: #ddffe8;
  --secondary-container: #6ecf9a;
  --accent: #f3ca40;
  --error: #f08a4b;
  --error-container: #4a1508;
  --on-error: #ffc8b0;
  --on-secondary-container: var(--on-primary);
  --font-ui: "Plus Jakarta Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-scale: 1;
}

html.font-sm { --font-scale: 0.9; }
html.font-md { --font-scale: 1; }
html.font-lg { --font-scale: 1.12; }

* { box-sizing: border-box; }

html { font-size: calc(16px * var(--font-scale)); }

body {
  margin: 0;
  background: var(--gradient-radial);
  background-color: var(--bg);
  color: var(--on-surface);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

html {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 55%, var(--outline-variant)) transparent;
}
html::-webkit-scrollbar { width: 10px; height: 10px; }
html::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-container) 35%, transparent);
}
html::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 65%, var(--outline-variant));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
html::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary) 80%, var(--secondary));
  background-clip: padding-box;
}

/* Critical shell layout — stable before Tailwind CDN hydrates */
.hidden { display: none !important; }

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 15rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.75rem;
  z-index: 50;
  border-right: 2px solid color-mix(in srgb, var(--secondary) 40%, transparent);
  overflow: hidden;
  min-height: 0;
}
.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--outline-variant) 70%, transparent) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--outline-variant) 70%, transparent);
  border-radius: 3px;
}
.sidebar-footer { flex-shrink: 0; }

#top-header {
  position: fixed;
  top: 0;
  left: 15rem;
  right: 0;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 1.25rem;
  z-index: 40;
  border-bottom: 2px solid color-mix(in srgb, var(--outline) 50%, transparent);
}

#top-header > div {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 auto;
}

#top-header > div:last-child {
  flex: 0 0 auto;
  gap: 0.5rem;
}

#main-shell {
  margin-left: 15rem;
  margin-top: 4rem;
  padding: 1.5rem;
  min-height: 100vh;
}

#btn-mobile-nav { display: none; }

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-right);
  z-index: 100;
  pointer-events: none;
}

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-outline { color: var(--outline) !important; }
.text-error { color: var(--error) !important; }
.bg-background { background-color: var(--bg) !important; }
.bg-surface-container-low { background-color: var(--surface-low) !important; }
.border-emerald\/40 { border-color: color-mix(in srgb, var(--secondary) 50%, transparent) !important; }
.border-red-ochre\/50 { border-color: color-mix(in srgb, var(--outline) 65%, transparent) !important; }

.btn-inline { width: auto !important; display: inline-flex; max-width: 100%; flex: 0 0 auto; align-self: flex-start; }
.quick-toggles-panel .btn { width: auto; align-self: flex-start; flex: 0 0 auto; }

.font-mono { font-family: var(--font-mono); }

.label-caps {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--light-bronze);
}

html.light .glass-panel {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-color: color-mix(in srgb, var(--outline) 35%, transparent);
  color: var(--on-surface);
}
html.light #sidebar {
  background: linear-gradient(180deg, var(--surface-low) 0%, var(--surface) 50%, var(--surface-low) 100%) !important;
}
html.light #top-header {
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--primary) 12%, transparent), color-mix(in srgb, var(--surface) 96%, transparent)) !important;
}
html.light .nav-active {
  background: color-mix(in srgb, var(--secondary) 18%, transparent) !important;
  color: var(--primary) !important;
}

.glass-panel {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--outline) 40%, transparent);
  border-radius: 0.625rem;
  box-shadow: 0 4px 24px color-mix(in srgb, var(--secondary) 8%, transparent);
  color: var(--on-surface);
}

.status-glow-success {
  box-shadow: 0 0 8px var(--emerald);
  animation: breathe 3s infinite ease-in-out;
}
.status-glow-primary {
  box-shadow: 0 0 8px var(--light-bronze);
  animation: breathe 4s infinite ease-in-out;
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.terminal-scroll::-webkit-scrollbar { width: 5px; }
.terminal-scroll::-webkit-scrollbar-track { background: rgba(12, 12, 12, 0.6); }
.terminal-scroll::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(8px);
}
#loading-overlay[hidden] { display: none !important; }

.loading-progress-wrap {
  width: min(22rem, 80vw);
  height: 6px;
  background: rgba(186, 90, 49, 0.3);
  border-radius: 999px;
  overflow: hidden;
}
.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--gradient-right);
  border-radius: 999px;
  transition: width 0.25s ease-out;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(229, 159, 113, 0.2);
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 24rem;
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  border: 1px solid rgba(186, 90, 49, 0.45);
  background: var(--surface-high);
  animation: slideIn 0.2s ease-out;
}
.toast.ok { border-color: var(--emerald); color: var(--emerald); }
.toast.err { border-color: var(--error); color: #ffc8b0; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

#sidebar nav a,
#sidebar .sidebar-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  text-align: left;
  border-radius: 0.375rem;
  color: color-mix(in srgb, var(--on-surface) 78%, transparent);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
#sidebar nav a:hover,
#sidebar .sidebar-link:hover {
  background: color-mix(in srgb, var(--secondary) 12%, transparent);
  color: var(--primary);
}

#sidebar {
  background: linear-gradient(180deg, var(--surface-low) 0%, var(--surface) 50%, var(--surface-low) 100%) !important;
}

#top-header {
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--primary) 10%, transparent), color-mix(in srgb, var(--surface) 96%, transparent)) !important;
}

.nav-active {
  color: var(--light-bronze) !important;
  font-weight: 700;
  border-left: 4px solid var(--emerald);
  background: rgba(105, 220, 158, 0.12) !important;
  padding-left: calc(1rem - 4px);
}

.sidebar-brand .brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--light-bronze);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.sidebar-brand .brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: color-mix(in srgb, var(--on-surface) 48%, transparent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.35rem;
}
.sidebar-brand .brand-version {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: color-mix(in srgb, var(--on-surface) 38%, transparent);
  margin-top: 0.25rem;
}

.training-header-block {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex-wrap: wrap;
}
.training-header-block[hidden] { display: none !important; }
.training-header-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--light-bronze);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.page-header-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--light-bronze);
  font-family: var(--font-ui);
  letter-spacing: -0.01em;
}
.page-subtitle {
  font-size: 0.9375rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--on-surface) 65%, transparent);
}

#training-top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.area-tab {
  padding: 0.3rem 0.7rem;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 0.25rem;
  color: color-mix(in srgb, var(--on-surface) 70%, transparent);
  text-decoration: none;
  border: 1px solid transparent;
}
.area-tab:hover { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.area-tab.active {
  color: var(--on-primary);
  background: var(--primary);
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.15s, transform 0.1s, background 0.15s, border-color 0.15s;
  font-family: var(--font-ui);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--secondary-container); color: var(--on-secondary-container); border-color: var(--secondary-container); }
.btn-secondary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: var(--outline-variant); color: var(--on-surface); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.btn-danger { background: var(--error-container); color: var(--on-error); border-color: var(--error); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn.is-loading { pointer-events: none; opacity: 0.75; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}
.badge.ok { background: rgba(105, 220, 158, 0.2); color: var(--emerald); }
.badge.warn { background: rgba(229, 159, 113, 0.2); color: var(--light-bronze); }
.badge.bad { background: rgba(186, 90, 49, 0.35); color: #ffc8b0; }
.badge.neutral { background: color-mix(in srgb, var(--on-surface) 10%, transparent); color: color-mix(in srgb, var(--on-surface) 75%, transparent); }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.auth-gate[hidden] { display: none !important; }
.auth-panel {
  width: min(24rem, 100%);
  padding: 1.5rem;
}
.auth-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 35%, transparent);
}
.auth-tab {
  flex: 1;
  border: none;
  border-radius: 0.375rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--on-surface) 70%, transparent);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.auth-tab.active {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
  color: var(--primary);
}
.auth-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.password-field {
  position: relative;
}
.password-field input {
  width: 100%;
}
.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
}
.password-toggle:hover { color: var(--primary); }

.badge-offline {
  background: rgba(186, 90, 49, 0.18);
  color: var(--red-ochre);
  font-size: 10px;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
}

.training-stack { display: flex; flex-direction: column; gap: 1.75rem; }
.training-panel {
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.training-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.training-feature-grid label {
  padding: 1rem 1.1rem !important;
  gap: 0.75rem;
}
.hint-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.2rem;
}
.hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--onyx);
  background: var(--light-bronze);
  cursor: help;
}
.hint-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  width: max-content;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.35rem;
  background: var(--surface-highest);
  border: 1px solid rgba(186, 90, 49, 0.45);
  color: var(--on-surface);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--font-ui);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 20;
}
.hint-wrap:hover .hint-tooltip,
.hint-wrap:focus .hint-tooltip,
.hint-wrap:focus-within .hint-tooltip {
  opacity: 1;
  visibility: visible;
}

.hw-panel { display: flex; flex-direction: column; gap: 0.55rem; min-height: 6rem; }
.hw-row { display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 0.5rem; align-items: center; }
.hw-label { font-family: var(--font-mono); font-size: 0.625rem; text-transform: uppercase; color: var(--light-bronze); }
.hw-bar { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
.hw-fill { height: 100%; background: var(--secondary); border-radius: 999px; transition: width 0.35s ease; }
.hw-fill-temp { background: var(--primary); }
.hw-val { font-family: var(--font-mono); font-size: 0.625rem; color: rgba(255, 255, 255, 0.75); }

.forum-pred-chart-wrap {
  height: 30rem;
  margin-top: 0.5rem;
}
.predict-chart-wrap {
  height: 30rem;
  margin-top: 0.5rem;
}
.backtest-chart-wrap {
  height: 30rem;
  margin-top: 0.5rem;
}
.forum-prediction {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(105, 220, 158, 0.35);
  background: rgba(105, 220, 158, 0.08);
}
.forum-comment {
  padding: 0.5rem 0;
  border-top: 1px solid rgba(186, 90, 49, 0.2);
}
.forum-comment:first-child { border-top: none; }

.fixed-feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.fixed-feature-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.35rem 0.55rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(186, 90, 49, 0.35);
  background: rgba(20, 20, 20, 0.5);
  color: rgba(255, 255, 255, 0.75);
  max-width: 11rem;
}
.fixed-feature-chip .feature-desc {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.3;
}
html.light .fixed-feature-chip {
  background: rgba(255, 255, 255, 0.8);
  color: rgba(26, 20, 16, 0.75);
}
html.light .fixed-feature-chip .feature-desc {
  color: rgba(26, 20, 16, 0.5);
}

.chart-panel-fixed {
  position: relative;
  width: 100%;
}
.chart-panel-market { height: 360px; }
.chart-panel-metrics { height: 300px; }
.chart-panel-market.has-rsi { height: 480px; }
.chart-panel-fixed canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.chart-panel-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--on-surface-variant);
  font-size: 0.75rem;
}
.chart-panel-overlay.hidden { display: none; }

.sensitive-eye-icon {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}
.sensitive-toggle {
  min-width: 2.25rem;
  padding: 0.35rem 0.5rem;
}

.forum-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}
.forum-react-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 0.25rem;
  border: 1px solid var(--outline-variant);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.forum-react-btn[data-react-value="like"] {
  color: var(--emerald);
  border-color: color-mix(in srgb, var(--emerald) 50%, var(--outline-variant));
}
.forum-react-btn[data-react-value="dislike"] {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 50%, var(--outline-variant));
}
.forum-react-btn[data-react-value="like"]:hover:not(:disabled) {
  border-color: var(--emerald);
  background: color-mix(in srgb, var(--emerald) 14%, transparent);
}
.forum-react-btn[data-react-value="dislike"]:hover:not(:disabled) {
  border-color: var(--error);
  background: color-mix(in srgb, var(--error) 14%, transparent);
}
.forum-react-btn.active-like {
  border-color: var(--emerald);
  color: var(--on-primary);
  background: var(--emerald);
}
.forum-react-btn.active-dislike {
  border-color: var(--error);
  color: var(--on-error);
  background: var(--error);
}
.forum-react-btn:disabled { opacity: 0.55; cursor: wait; }

.forum-author-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.forum-author-link:hover {
  text-decoration: underline;
  color: var(--secondary);
}

.forum-user-profile .profile-bio {
  white-space: pre-wrap;
}

.leverage-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}
.leverage-slider {
  flex: 1;
  accent-color: var(--primary);
}
.leverage-value {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  min-width: 2.5rem;
  text-align: right;
  color: var(--primary);
}

.mcap-rank-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}
.mcap-rank-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  padding: 0.2rem 0.45rem;
  border-radius: 0.2rem;
  border: 1px solid color-mix(in srgb, var(--outline-variant) 55%, transparent);
  color: var(--on-surface);
  background: color-mix(in srgb, var(--surface-high) 88%, transparent);
}
.mcap-rank-chip .mcap-rank-num {
  color: var(--on-surface-variant);
  font-size: 0.625rem;
}

.memory-lines {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  line-height: 1.35;
}

.stat-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-card-title::before {
  content: "";
  width: 4px;
  height: 1rem;
  border-radius: 2px;
  background: var(--gradient-bottom);
  flex-shrink: 0;
}

.toggle {
  position: relative;
  width: 2.5rem;
  height: 1.25rem;
  background: var(--surface-highest);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle.on { background: rgba(105, 220, 158, 0.35); }
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle.on::after {
  transform: translateX(1.25rem);
  background: var(--emerald);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  background: var(--surface-highest);
  height: 4px;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  background: var(--light-bronze);
  border-radius: 50%;
  margin-top: -6px;
  cursor: pointer;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--light-bronze);
  margin-bottom: 0.35rem;
}
.field input, .field select {
  width: 100%;
  background: var(--bg);
  color: var(--on-surface);
  border: 1px solid rgba(186, 90, 49, 0.45);
  border-radius: 0.375rem;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 13px;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--emerald);
}

input[type="number"] {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary) 55%, var(--outline-variant)) transparent;
}
input[type="number"]::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
input[type="number"]::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--surface-container) 35%, transparent);
  border-radius: 999px;
}
input[type="number"]::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 65%, var(--outline-variant));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
input[type="number"]::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary) 80%, var(--secondary));
  background-clip: padding-box;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
  height: 1.35rem;
  filter: sepia(0.35) saturate(2.2) hue-rotate(-18deg) brightness(1.05);
}
input[type="number"]:hover::-webkit-inner-spin-button,
input[type="number"]:hover::-webkit-outer-spin-button,
input[type="number"]:focus::-webkit-inner-spin-button,
input[type="number"]:focus::-webkit-outer-spin-button {
  filter: sepia(0.5) saturate(2.8) hue-rotate(-22deg) brightness(1.1);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(12, 12, 12, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-panel {
  background: var(--surface);
  border: 1px solid rgba(186, 90, 49, 0.5);
  border-radius: 0.75rem;
  padding: 1.5rem;
  max-width: 28rem;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.confirm-panel .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.confirm-open #main-shell {
  pointer-events: none;
}

.activity-feed-body.collapsed {
  max-height: 14rem;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 75%, transparent);
}
.activity-feed-body.expanded {
  max-height: none;
  overflow: visible;
  mask-image: none;
}
.log-view-wrap pre {
  min-height: 0;
}

@keyframes skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.skel {
  display: block;
  border-radius: 0.25rem;
  background: linear-gradient(90deg, rgba(26, 26, 26, 0.5) 0%, rgba(186, 90, 49, 0.25) 50%, rgba(26, 26, 26, 0.5) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
.skel-line { height: 0.75rem; margin: 0.35rem 0; }
.skel-line.sm { height: 0.55rem; }
.skel-line.lg { height: 1.25rem; }
.skel-card { min-height: 130px; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }

.view-loading-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(105, 220, 158, 0.35);
  background: rgba(186, 90, 49, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8125rem;
}
.view-loading-banner[hidden] { display: none !important; }

.sync-bar {
  position: fixed;
  top: 4rem;
  left: 15rem;
  right: 0;
  height: 2px;
  z-index: 45;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}
.sync-bar.active { opacity: 1; }
.sync-bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 35%;
  background: var(--emerald);
  transform: translateX(-100%);
  animation: sync-slide 1.1s ease-in-out infinite;
}
@keyframes sync-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.spinner-inline {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(229, 159, 113, 0.2);
  border-top-color: var(--emerald);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
.spinner-inline.lg { width: 1.75rem; height: 1.75rem; border-width: 3px; }

.panel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 12rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8125rem;
}

.panel-busy {
  position: relative;
  opacity: 0.92;
}
.panel-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: color-mix(in srgb, var(--surface) 25%, transparent);
}

.view-error {
  padding: 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(186, 90, 49, 0.5);
  background: rgba(61, 31, 18, 0.55);
  color: #ffc8b0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

#hdr-sync[hidden] { display: none !important; }
#hdr-sync {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-mono);
}

@media (max-width: 1024px) {
  #sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  #sidebar.open { transform: translateX(0); }
  #main-shell { margin-left: 0 !important; }
  #top-header { left: 0 !important; width: 100% !important; }
  #sync-bar { left: 0 !important; }
  #btn-mobile-nav { display: inline-flex !important; }
}
