/* ==========================================================================
   Homepage stylesheet: used only by html/homepage.php.
   Self-contained, with no Bootstrap dependency. Deliberately separate from
   public/css/style.css, which the admin login page still uses.
   ========================================================================== */

:root {
  --bg: #070d1a;
  --bg-2: #0b1324;
  --surface: #0f1a2e;
  --surface-2: #142038;
  --surface-3: #1a2844;
  --border: #1f2d4a;
  --border-strong: #2b3c60;
  --text: #e8edf7;
  --text-2: #b4c0d6;
  --muted: #7f8ca6;
  --primary: #4f7cff;
  --primary-2: #6b8fff;
  --primary-soft: rgba(79, 124, 255, 0.14);
  --up: #16c784;
  --up-soft: rgba(22, 199, 132, 0.12);
  --down: #f0475a;
  --down-soft: rgba(240, 71, 90, 0.12);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.14);
  --info: #38bdf8;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --container: 1240px;
  --nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 48px); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(79, 124, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(56, 189, 248, 0.06), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

img { max-width: 100%; display: block; }
a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #9db4ff; }
button { font: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }

.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.svg-sprite { display: none; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Demo banner ---------- */
.demo-banner {
  background: var(--warn-soft);
  border-bottom: 1px solid rgba(245, 165, 36, 0.3);
  color: #fcd28a;
  font-size: 13px;
}
.demo-banner .container { display: flex; align-items: center; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
.demo-banner strong { color: #ffe1a8; }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  cursor: pointer; transition: background .15s, border-color .15s, transform .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--primary); --btn-bd: var(--primary); --btn-fg: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-success { --btn-bg: rgba(22,199,132,.14); --btn-bd: rgba(22,199,132,.45); --btn-fg: #4ee3a8; }
.btn-success:hover { background: rgba(22,199,132,.22); }
.btn-danger { --btn-bg: rgba(240,71,90,.12); --btn-bd: rgba(240,71,90,.45); --btn-fg: #ff7d8c; }
.btn-danger:hover { background: rgba(240,71,90,.2); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; padding: 0; }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-strong);
}
.badge-warn { background: var(--warn-soft); color: #fcc76a; border-color: rgba(245,165,36,.35); }
.badge-live { background: var(--up-soft); color: #4ee3a8; border-color: rgba(22,199,132,.35); }
.badge-sample { background: var(--warn-soft); color: #fcc76a; border-color: rgba(245,165,36,.35); }
.badge-error { background: var(--down-soft); color: #ff8b98; border-color: rgba(240,71,90,.35); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-live .dot { animation: pulse 1.8s infinite; }

.pct {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.pct-pill { padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.pct-pill.up { background: var(--up-soft); }
.pct-pill.down { background: var(--down-soft); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 13, 26, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 28px; height: var(--nav-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; }
.brand:hover { color: var(--text); }
.brand img { height: 34px; width: auto; border-radius: 8px; }
.brand-fallback {
  display: none; width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #7c5cff); color: #fff;
  align-items: center; justify-content: center; font-weight: 800;
}
.brand.no-logo img { display: none; }
.brand.no-logo .brand-fallback { display: inline-flex; }
/* The logo image already contains the wordmark: show the text name only when the logo is missing. */
.site-header .brand:not(.no-logo) .brand-name { display: none; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
body { overflow-x: clip; }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links > li { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; font-size: 14.5px;
  background: none; border: 0; cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.is-active { color: var(--text); background: var(--primary-soft); }
.nav-link .chev { width: 14px; height: 14px; transition: transform .2s; }
.dropdown.is-open .chev { transform: rotate(180deg); }

.dropdown-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 240px;
  padding: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .15s, transform .15s, visibility .15s;
  list-style: none; margin: 0;
}
.dropdown.is-open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; color: var(--text);
}
.dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu small { display: block; color: var(--muted); font-size: 12.5px; }
.dropdown-menu .icon { margin-top: 2px; color: var(--primary-2); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-toggle { display: none; }

/* Mobile drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(3, 6, 14, .6); z-index: 60;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); z-index: 61;
  background: var(--bg-2); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; padding: 18px;
  overflow-y: auto;
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.drawer nav a {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500;
}
.drawer nav a:hover, .drawer nav a.is-active { background: var(--surface-2); color: var(--text); }
.drawer-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 12px 6px; }
.drawer-actions { margin-top: auto; display: grid; gap: 10px; padding-top: 18px; }

/* ---------- Ticker ---------- */
.ticker {
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden; position: relative;
  height: 40px;
}
.ticker::before, .ticker::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 60px; z-index: 1; pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(90deg, var(--bg-2), transparent); }
.ticker::after { right: 0; background: linear-gradient(-90deg, var(--bg-2), transparent); }
.ticker-track {
  display: flex; gap: 32px; width: max-content; height: 100%; align-items: center;
  padding-left: 24px; animation: ticker 70s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; color: var(--text-2); }
.ticker-item b { color: var(--text); font-weight: 600; }
.ticker-item img { width: 16px; height: 16px; border-radius: 50%; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-tight { padding: 28px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary-2); margin-bottom: 8px; }
.section-title { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; }
.section-sub { color: var(--muted); margin-top: 6px; max-width: 640px; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), rgba(15, 26, 46, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-title { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.card-body { padding: 16px 20px 20px; }
.card-hover { transition: border-color .2s, transform .2s, background .2s; }
.card-hover:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Hero ---------- */
.hero { padding: 44px 0 28px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.hero-title { font-size: clamp(32px, 4.4vw, 52px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.08; }
.hero-title .grad { background: linear-gradient(90deg, #8fb0ff, #4f7cff 50%, #7c5cff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--text-2); font-size: 17px; margin-top: 16px; max-width: 560px; }
.hero-ctas { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; color: var(--muted); font-size: 13px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }

.hero-chart { margin-top: 28px; }
.hero-chart .card-head { padding-bottom: 4px; }
.price-big { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.coin-ident { display: flex; align-items: center; gap: 12px; }
.coin-ident img, .coin-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--surface-3); }
.coin-avatar { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: var(--text-2); }
.coin-ident .sym { color: var(--muted); font-size: 13px; }

/* ---------- Segmented control ---------- */
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 12.5px;
  padding: 6px 11px; border-radius: 7px; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; height: 220px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: rgba(127, 140, 166, 0.12); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .crosshair { stroke: rgba(180, 192, 214, 0.35); stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 6px 10px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-lg);
  transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s;
}
.chart-tip b { display: block; font-size: 13px; }
.chart-empty, .chart-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 16px;
}
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spark { width: 120px; height: 36px; display: block; }

/* ---------- EA bot card ---------- */
.ea-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(500px 220px at 100% 0%, rgba(79, 124, 255, 0.18), transparent 60%),
    linear-gradient(180deg, #101c34, #0c1628);
  border-color: var(--border-strong);
}
.ea-head { display: flex; gap: 14px; align-items: flex-start; padding: 20px 20px 0; }
.ea-icon {
  width: 48px; height: 48px; border-radius: 13px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(79,124,255,.35), rgba(124,92,255,.25));
  border: 1px solid rgba(107,143,255,.45); color: #cdd9ff;
}
.ea-icon .icon { width: 26px; height: 26px; }
.ea-title { font-size: 17px; font-weight: 700; }
.ea-desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.ea-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.ea-status-bar {
  margin: 16px 20px 0; padding: 12px 14px; border-radius: 12px;
  background: rgba(7, 13, 26, 0.55); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.status-chip { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(127,140,166,.15); }
.st-disconnected .status-dot { background: #6b7891; box-shadow: 0 0 0 4px rgba(107,120,145,.18); }
.st-connecting .status-dot { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); animation: pulse 1s infinite; }
.st-connected .status-dot { background: var(--info); box-shadow: 0 0 0 4px rgba(56,189,248,.16); }
.st-running .status-dot { background: var(--up); box-shadow: 0 0 0 4px var(--up-soft); animation: pulse 1.8s infinite; }
.st-stopped .status-dot { background: #c3cbe0; box-shadow: 0 0 0 4px rgba(195,203,224,.12); }
.st-error .status-dot { background: var(--down); box-shadow: 0 0 0 4px var(--down-soft); }
.st-connecting .status-label { color: #fcc76a; }
.st-connected .status-label { color: #7dd3fc; }
.st-running .status-label { color: #4ee3a8; }
.st-error .status-label { color: #ff8b98; }

.ea-rows { list-style: none; margin: 0; padding: 6px 20px 0; }
.ea-rows li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.ea-rows li:last-child { border-bottom: 0; }
.ea-rows .k { color: var(--muted); }
.ea-rows .v { font-weight: 600; text-align: right; }
.ea-rows .v.na { color: var(--muted); font-weight: 500; }

.ea-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 20px 0; }
.ea-actions-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 20px 20px; }
.ea-connect { padding: 0 20px; margin-top: 12px; }
.ea-note {
  margin: 0 20px 20px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
  background: var(--warn-soft); color: #fcd28a; border: 1px solid rgba(245,165,36,.25);
  display: flex; gap: 8px; align-items: flex-start;
}
.ea-note .icon { width: 16px; height: 16px; margin-top: 2px; }
.ea-error-msg { margin: 10px 20px 0; font-size: 12.5px; color: #ff8b98; }

.pair-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 0; }
.pair-chip {
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); cursor: pointer;
}
.pair-chip:hover { border-color: var(--border-strong); color: var(--text); }
.pair-chip.is-selected { background: var(--primary-soft); border-color: rgba(79,124,255,.5); color: #c6d4ff; }
.pair-chip[disabled] { cursor: not-allowed; opacity: .6; }

/* ---------- Account strip ---------- */
.account-strip { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(0, 1fr)); gap: 16px; }
.account-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.account-card .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.account-card .value { font-size: 22px; font-weight: 700; }
.account-card .value.na { color: var(--muted); font-size: 16px; font-weight: 600; }
.account-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.quick-link { display: flex; align-items: center; gap: 12px; color: var(--text); }
.quick-link:hover { color: var(--text); }
.quick-link .ql-icon {
  width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: #a9bdff; flex: none;
}
.quick-link small { display: block; color: var(--muted); font-size: 12.5px; }

/* ---------- Overview stats ---------- */
.stat-card { padding: 18px 20px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-value { font-size: 24px; font-weight: 750; margin-top: 8px; letter-spacing: -0.015em; }
.stat-foot { margin-top: 6px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 12px; display: flex; }
.meter span { display: block; height: 100%; }

/* ---------- Mover lists ---------- */
.mover-list { list-style: none; margin: 0; padding: 4px 8px 10px; }
.mover-list li > button, .mover-list li > .row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  background: none; border: 0; color: inherit; text-align: left; cursor: pointer;
}
.mover-list li > button:hover { background: var(--surface-2); }
.mover-list .name { flex: 1; min-width: 0; }
.mover-list .name b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mover-list .name small { color: var(--muted); }
.mover-list .right { text-align: right; }
.mover-list .right b { display: block; font-weight: 600; }
.mover-list img, .mover-list .coin-avatar { width: 28px; height: 28px; }
.list-skel { height: 48px; margin: 6px 12px; }

/* ---------- Market table ---------- */
.market-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input, .select {
  width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--text); padding: 0 12px; font: inherit; font-size: 14px;
}
.input::placeholder { color: #66738d; }
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search .input { padding-left: 38px; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237f8ca6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select option, .select optgroup { background: var(--surface); color: var(--text); }
.toolbar-spacer { flex: 1; }
.sort-select { width: auto; min-width: 190px; }

.table-wrap { overflow-x: auto; }
.mkt-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.mkt-table th, .mkt-table td { padding: 14px 16px; text-align: right; white-space: nowrap; }
.mkt-table th {
  position: sticky; top: 0; background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
.mkt-table th.left, .mkt-table td.left { text-align: left; }
.mkt-table th button {
  background: none; border: 0; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 0;
}
.mkt-table th button:hover { color: var(--text); }
.mkt-table th[aria-sort="ascending"] button, .mkt-table th[aria-sort="descending"] button { color: var(--text); }
.sort-ind { opacity: .5; font-size: 10px; }
.mkt-table th[aria-sort] .sort-ind { opacity: 1; }
.mkt-table tbody tr { border-bottom: 1px solid rgba(31, 45, 74, 0.6); transition: background .12s; }
.mkt-table tbody tr:hover { background: rgba(26, 40, 68, 0.45); }
.mkt-table td { font-variant-numeric: tabular-nums; font-size: 14.5px; }
.mkt-table td.rank { color: var(--muted); width: 48px; }
.mkt-table .coin-cell { display: flex; align-items: center; gap: 12px; }
.mkt-table .coin-cell img, .mkt-table .coin-cell .coin-avatar { width: 28px; height: 28px; }
.mkt-table .coin-name { font-weight: 600; color: var(--text); }
.mkt-table .coin-sym { color: var(--muted); font-size: 13px; font-weight: 500; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 32px; height: 32px; margin: 0 auto 10px; display: block; color: var(--border-strong); }

/* Mobile market cards (built from the same rows) */
.mkt-cards { display: none; list-style: none; margin: 0; padding: 8px; }
.mkt-cards li > button {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px; border-radius: 12px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer;
}
.mkt-cards li > button:hover { background: var(--surface-2); }
.mkt-cards li + li { border-top: 1px solid rgba(31,45,74,.6); }
.mkt-cards .c-avatar { grid-row: span 2; }
.mkt-cards .c-avatar img, .mkt-cards .c-avatar .coin-avatar { width: 34px; height: 34px; }
.mkt-cards .c-name { font-weight: 600; }
.mkt-cards .c-price { text-align: right; font-weight: 600; }
.mkt-cards .c-meta { color: var(--muted); font-size: 12.5px; }
.mkt-cards .c-chg { text-align: right; }

/* ---------- Performance bars ---------- */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .sym { font-weight: 600; }
.bar-track { position: relative; height: 22px; background: var(--bg-2); border-radius: 6px; }
.bar-track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--border-strong); }
.bar-fill { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; transition: width .5s ease, left .5s ease; }
.bar-fill.up { background: linear-gradient(90deg, rgba(22,199,132,.5), var(--up)); }
.bar-fill.down { background: linear-gradient(-90deg, rgba(240,71,90,.5), var(--down)); }
.bar-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Pairs / FX table ---------- */
.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th, .mini-table td { padding: 11px 8px; text-align: right; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.mini-table td { border-bottom: 1px solid rgba(31,45,74,.5); }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .left { text-align: left; }
.mini-table .pair { font-weight: 650; }
.mini-table .pair small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.mini-table tbody tr.clickable { cursor: pointer; }
.mini-table tbody tr.clickable:hover { background: rgba(26,40,68,.45); }
.source-note { font-size: 12px; color: var(--muted); padding: 0 20px 16px; }

/* ---------- Features ---------- */
.feature { padding: 22px; }
.feature .f-icon {
  width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: #a9bdff; margin-bottom: 14px;
}
.feature h3 { font-size: 16px; font-weight: 650; }
.feature p { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 48px 0 28px; margin-top: 32px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 32px; }
.footer-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--text-2); font-size: 14px; }
.footer-grid a:hover { color: var(--text); }
.footer-about p { color: var(--muted); font-size: 14px; margin-top: 12px; max-width: 360px; }
.footer-bottom {
  margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px;
}
.disclaimer { max-width: 760px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
}
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 14, .72); backdrop-filter: blur(3px); animation: fade .15s; }
.modal-dialog {
  position: relative; width: 100%; max-width: 760px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal-sm .modal-dialog { max-width: 560px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.coin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.coin-stats div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.coin-stats small { display: block; color: var(--muted); font-size: 12px; }
.coin-stats b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: #ff8b98; display: none; }
.field.invalid .input { border-color: var(--down); }
.field.invalid .err { display: block; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #c3cbe0; transition: transform .15s; }
.switch input:checked { background: var(--primary); border-color: var(--primary); }
.switch input:checked::after { transform: translateX(16px); background: #fff; }
.form-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 22px 0 10px; grid-column: 1 / -1; }
.form-section-title:first-child { margin-top: 0; }
.demo-tools { margin-top: 20px; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.demo-tools span { font-size: 12.5px; color: var(--muted); flex: 1 1 200px; }

/* Tabs in modal */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.log-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.log-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.log-list time { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; min-width: 72px; }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 16px;
  box-shadow: var(--shadow-lg); font-size: 14px; max-width: 360px; animation: pop .2s ease;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.ok { border-color: rgba(22,199,132,.45); }
.toast.err { border-color: rgba(240,71,90,.5); }

/* Data source notice */
.data-notice {
  display: none; margin-bottom: 18px; padding: 12px 16px; border-radius: 12px;
  background: var(--warn-soft); border: 1px solid rgba(245,165,36,.3); color: #fcd28a; font-size: 13.5px;
  align-items: center; gap: 12px; flex-wrap: wrap;
}
.data-notice.is-visible { display: flex; }
.data-notice .btn { margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-actions .hide-md { display: none; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .ea-card { max-width: 720px; }
  .account-strip { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3.movers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3.movers > :first-child { grid-column: 1 / -1; }
  .perf-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .container { padding: 0 16px; }
  .section { padding: 40px 0; }
  .hero { padding-top: 28px; }
  .hero-sub { font-size: 15.5px; }
  .hero-ctas .btn { flex: 1 1 auto; }
  .account-strip { grid-template-columns: minmax(0, 1fr); }
  .grid-2, .grid-3, .grid-3.movers, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 19px; }
  .market-toolbar { padding: 14px; }
  .search { max-width: none; flex-basis: 100%; }
  .market-toolbar .seg { flex: 1; }
  .market-toolbar .seg button { flex: 1; }
  .sort-select { flex: 1; min-width: 0; }
  .toolbar-spacer { display: none; }
  .table-wrap { display: none; }
  .mkt-cards { display: block; }
  .coin-stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-dialog { max-height: 92vh; border-radius: 20px 20px 0 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
  .chart { height: 190px; }
  .price-big { font-size: 24px; }
  .bar-row { grid-template-columns: 54px 1fr 62px; }
  .nav-actions .hide-sm { display: none; }
  .demo-banner .container { font-size: 12px; }
}

@media (max-width: 420px) {
  .mini-table th, .mini-table td { padding: 10px 5px; font-size: 12.5px; }
  .mini-table .spark { width: 56px; }
  .grid-4.stats { grid-template-columns: minmax(0, 1fr); }
  .ea-actions, .ea-actions-2 { grid-template-columns: 1fr 1fr; }
  .brand span.brand-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .ticker-track { animation: none; }
}

/* ---------- Sign-in dialog (posts to the existing /login_processor) ---------- */
.login-form { display: grid; gap: 16px; }
.login-form .field label .req { color: var(--down); }
.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.login-alt { text-align: center; font-size: 13.5px; color: var(--muted); }