/* XAUUSD dashboard - light theme.
 *
 * Every class name here matches the previous dark stylesheet, so the
 * templates and the JS that toggles classes are untouched. What changed is
 * the palette, the type scale and the spacing.
 *
 * Two things are deliberate and worth knowing before editing:
 *
 * 1. The buy/sell/accent colours are DARKER than the dark theme's. #26a65b
 *    green and #d4af37 gold look right on near-black and fail contrast badly
 *    on white - gold on white is around 1.9:1, which is unreadable. These are
 *    re-picked for a white ground, not reused.
 * 2. No webfont. The Content-Security-Policy in app/security.py is
 *    "style-src 'self'", so a Google Fonts link would be blocked outright,
 *    and weakening the CSP for decoration is a bad trade on a dashboard that
 *    holds trading data. The hierarchy is carried by size, weight, letter
 *    spacing and tabular figures instead - and it loads instantly.
 */

:root {
  --shell: 1460px;            /* every page is this wide - see .layout */

  /* surfaces */
  --bg:            #F6F7F9;   /* page ground - cards lift off it */
  --panel:         #FFFFFF;   /* the cards themselves */
  --panel-2:       #F4F6F9;   /* inner tiles (was #0d1117) */
  --border:        #E2E6EC;
  --border-strong: #C9D0D9;

  /* ink */
  --text:   #141922;
  --muted:  #5A6675;
  --faint:  #86909E;

  /* semantics - re-picked for a white ground */
  --buy:      #0C7F48;
  --buy-soft: #E8F4EE;
  --sell:     #C32A28;
  --sell-soft:#FBEBEA;
  --warn:     #9C6509;
  --warn-soft:#FDF3E2;
  --accent:   #96701A;        /* gold, darkened until it is readable */
  --accent-soft:#FAF3E2;
  --on-accent:#FFFFFF;

  /* canvas charts read these (see dashboard.js / paper.js) */
  --chart-grid: #E9EDF2;
  --chart-axis: #77818F;
  --chart-ref:  #BFC7D1;

  --shadow-sm: 0 1px 2px rgba(20,25,34,.05);
  --shadow:    0 1px 3px rgba(20,25,34,.07), 0 1px 2px rgba(20,25,34,.04);

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo,
          Consolas, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }

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

/* Anything that is a number lines up in columns. */
.ind span, .stat span, .ctx-big, .verdict-pnl, .nc-move, #live-price,
.quote-line, .rec-item b, .cost-note b, td, .ci-labels {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* brand | nav | account */
  align-items: center;
  gap: 20px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}
/* The three zones are fixed. Previously this was a flexbox with
   space-between and either two or three children, so the nav sat centred on
   the Dashboard and jumped to the far right on Prediction and Verification -
   the page furniture appeared to move every time you clicked a link. */
.topbar > .brand { justify-self: start; }
.topbar > .nav { justify-self: center; }
.topbar-right {
  justify-self: end;
  display: flex; align-items: center; gap: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand.center { justify-content: center; margin-bottom: 4px; }
.brand h1 {
  font-size: 17px; margin: 0; font-weight: 650; letter-spacing: -.01em;
}
.brand h1 span { color: var(--accent); font-weight: 500; }

.nav { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 500;
  padding: 6px 11px; border-radius: 7px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--panel-2); font-weight: 600; }
.inline-form { display: inline; }
.link-btn {
  background: none; border: none; color: var(--muted); font-size: 14px;
  cursor: pointer; padding: 6px 11px; border-radius: 7px;
  font-family: inherit; font-weight: 500;
}
.link-btn:hover { color: var(--text); background: var(--panel-2); }
.nav a:focus-visible, .link-btn:focus-visible,
.auth-card input:focus-visible, .auth-card button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong); display: inline-block; flex: none;
}
.dot.live { background: var(--buy); box-shadow: 0 0 0 3px var(--buy-soft); }

.feed-health, .source-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--muted);
  background: var(--panel-2);
}
.feed-health.healthy { color: var(--buy);  border-color: var(--buy);  background: var(--buy-soft); }
.feed-health.stale   { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.feed-health.down    { color: var(--sell); border-color: var(--sell); background: var(--sell-soft); }
.source-badge[hidden] { display: none; }
.source-badge.sim  { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.source-badge.real { color: var(--buy);  border-color: var(--buy);  background: var(--buy-soft); }

.price-block { text-align: right; }
#live-price {
  font-size: 26px; font-weight: 700; letter-spacing: -.02em;
  display: inline-block; transition: color .1s;
}
#live-price.tick-up   { animation: flashUp .5s ease-out; }
#live-price.tick-down { animation: flashDown .5s ease-out; }
@keyframes flashUp   { 0% { color: var(--buy); }  100% { color: var(--text); } }
@keyframes flashDown { 0% { color: var(--sell); } 100% { color: var(--text); } }
.quote-line {
  display: block; font-size: 11.5px; color: var(--faint);
  margin-top: 1px; font-family: var(--mono);
}

.muted { color: var(--muted); font-size: 12.5px; display: block; }
.small { font-size: 12.5px; }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  padding: 18px 28px 40px;
  max-width: var(--shell);
  margin: 0 auto;
  align-items: start;        /* panels size to their content, never stretch */
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 14px 0; font-size: 11.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.panel h2 .muted { display: inline; text-transform: none; letter-spacing: 0;
                   font-weight: 400; color: var(--faint); }

.nextcandle-panel  { grid-column: 1 / span 2; }
.indicators-panel  { grid-column: 1 / span 2; }
.chart-panel       { grid-column: 1; }
.stats-panel       { grid-column: 2; }
.feed-panel        { grid-column: 1 / span 2; }

/* ------------------------------------------------- next-candle hero */
.nextcandle-panel {
  display: flex; align-items: center; gap: 30px;
  border-left: 4px solid var(--border-strong);
  transition: border-color .3s, background .3s;
}
.nextcandle-panel.up   { border-left-color: var(--buy);  background: linear-gradient(90deg, var(--buy-soft), var(--panel) 38%); }
.nextcandle-panel.down { border-left-color: var(--sell); background: linear-gradient(90deg, var(--sell-soft), var(--panel) 38%); }
.nc-left { display: flex; flex-direction: column; gap: 3px; min-width: 220px; }
.nc-label { font-size: 10.5px; letter-spacing: .12em; color: var(--faint); font-weight: 700; }
.nc-call { display: flex; align-items: center; gap: 10px; }
.nc-arrow { font-size: 30px; line-height: 1; color: var(--faint); }
.nc-move { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.nextcandle-panel.up   .nc-arrow, .nextcandle-panel.up   .nc-move { color: var(--buy); }
.nextcandle-panel.down .nc-arrow, .nextcandle-panel.down .nc-move { color: var(--sell); }
.nc-prob { font-size: 12.5px; color: var(--muted); }
.nc-mid { flex: 1; }
.nc-meter { height: 8px; background: var(--panel-2); border-radius: 999px;
            overflow: hidden; border: 1px solid var(--border); }
.nc-meter-fill { height: 100%; width: 50%; background: var(--border-strong);
                 border-radius: 999px; transition: width .4s, background .3s; }
.nc-meter-fill.up   { background: var(--buy); }
.nc-meter-fill.down { background: var(--sell); }
.nc-sub { font-size: 12.5px; color: var(--muted); display: block; margin-top: 7px; }
.nc-link { color: var(--accent); text-decoration: none; font-size: 13.5px;
           font-weight: 600; white-space: nowrap; }
.nc-link:hover { text-decoration: underline; }

/* ------------------------------------------------- indicator tiles */
.ind-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.ind {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 10px; text-align: center;
}
.ind label {
  display: block; color: var(--faint); font-size: 10.5px;
  letter-spacing: .06em; margin-bottom: 5px; font-weight: 700;
  text-transform: uppercase;
}
.ind span { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.ind span.hot, .ind span.down { color: var(--sell); }
.ind span.cold, .ind span.up  { color: var(--buy); }

.chart-head { display: flex; justify-content: space-between; align-items: baseline;
              margin-bottom: 10px; gap: 12px; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }

/* ------------------------------------------------- market context */
.context-panel { grid-column: 1 / span 2; }
.ctx-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr; gap: 12px; }
.ctx-block {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px; display: flex;
  flex-direction: column; gap: 5px;
}
.ctx-block > label {
  color: var(--faint); font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 700;
}
.ctx-big { font-size: 18px; font-weight: 650; text-transform: capitalize;
           letter-spacing: -.01em; }
.ctx-big.up { color: var(--buy); }
.ctx-big.down { color: var(--sell); }
.ctx-big.flatwarn { color: var(--warn); }
.ctx-big.muted-val { color: var(--muted); }
.ctx-sub { font-size: 11.5px; color: var(--muted); }
.tf-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tf {
  font-size: 11.5px; padding: 3px 8px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); font-weight: 500;
}
.tf b { font-weight: 700; }
.tf.up   { color: var(--buy);  border-color: var(--buy);  background: var(--buy-soft); }
.tf.down { color: var(--sell); border-color: var(--sell); background: var(--sell-soft); }
.tf.flat { color: var(--muted); }
.ctx-verdict { font-size: 12.5px; font-weight: 650; margin-top: 2px; }
.ctx-verdict.up { color: var(--buy); }
.ctx-verdict.down { color: var(--sell); }
.ctx-verdict.flat { color: var(--warn); }
.ctx-quality { border-color: var(--border-strong); }

.vol-gauge { height: 7px; background: var(--panel); border: 1px solid var(--border);
             border-radius: 999px; overflow: hidden; margin: 6px 0 4px; }
.vol-gauge-fill { height: 100%; width: 4%; border-radius: 999px;
                  background: var(--border-strong); transition: width .4s, background .3s; }
.vol-gauge-fill.up   { background: var(--buy); }
.vol-gauge-fill.down { background: var(--sell); }
.vol-gauge-fill.calm { background: var(--faint); }

/* ------------------------------------------------- stat tiles */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 10px; text-align: center;
}
.stat span { display: block; font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.stat label { color: var(--faint); font-size: 11px; font-weight: 600;
              text-transform: uppercase; letter-spacing: .05em; }
.stat.buy span  { color: var(--buy); }
.stat.sell span { color: var(--sell); }
.stat.win span  { color: var(--accent); }

/* ------------------------------------------------- paper trading */
.panel.wide { grid-column: 1 / span 2; }
.stats-grid.six { grid-template-columns: repeat(6, 1fr); }

.verdict-panel {
  grid-column: 1 / span 2;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-left: 4px solid var(--border-strong);
}
.verdict-panel.good    { border-left-color: var(--buy);  background: linear-gradient(90deg, var(--buy-soft), var(--panel) 42%); }
.verdict-panel.bad     { border-left-color: var(--sell); background: linear-gradient(90deg, var(--sell-soft), var(--panel) 42%); }
.verdict-panel.neutral { border-left-color: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--panel) 42%); }
.verdict-left { display: flex; flex-direction: column; gap: 7px; }
.verdict-text { font-size: 15px; line-height: 1.55; max-width: 72ch; color: var(--text); }
.verdict-right { text-align: right; white-space: nowrap; }
.verdict-pnl { display: block; font-size: 31px; font-weight: 700; letter-spacing: -.02em; }
.verdict-pnl.up   { color: var(--buy); }
.verdict-pnl.down { color: var(--sell); }

.cost-note {
  display: flex; flex-wrap: wrap; gap: 22px; margin-top: 14px;
  padding-top: 13px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.cost-note b { color: var(--text); font-weight: 650; }
#pt-expectancy.up   { color: var(--buy); }
#pt-expectancy.down { color: var(--sell); }

/* ------------------------------------------------- tables */
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.feed-empty { color: var(--muted); font-size: 13.5px; padding: 28px 6px; text-align: center; }
.feed-empty[hidden] { display: none; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--border); }
th {
  color: var(--faint); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border-strong);
  position: sticky; top: 0; background: var(--panel); z-index: 1;
}
tbody tr:hover td { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: none; }
td.dir-BUY  { color: var(--buy);  font-weight: 700; }
td.dir-SELL { color: var(--sell); font-weight: 700; }

.status-win     { color: var(--buy);  font-weight: 650; }
.status-loss    { color: var(--sell); font-weight: 650; }
.status-pending { color: var(--muted); }
.status-expired { color: var(--faint); font-style: italic; }
.reason-cell    { color: var(--muted); max-width: 340px; }

/* ------------------------------------------------- track record strip */
.record-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
  max-width: calc(var(--shell) - 56px);   /* matches .layout's content box,
     which is the shell minus its 28px gutters - otherwise the strip sat
     wider than the panels underneath it */
  margin: 18px auto 0; padding: 12px 18px;
  border-radius: 12px; font-size: 12.5px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  border-left-width: 4px; border-left-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.record-strip.good    { border-left-color: var(--buy); }
.record-strip.bad     { border-left-color: var(--sell); }
.record-strip.neutral { border-left-color: var(--warn); }
.rec-item b { color: var(--text); font-size: 13.5px; font-weight: 700; }
.rec-item b.up { color: var(--buy); }
.rec-item b.down { color: var(--sell); }
.rec-verdict { margin-left: auto; font-style: italic; color: var(--faint); }

.layout.single { grid-template-columns: 1fr; }

/* ------------------------------------------------- page header band */
.page-head {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.page-head-inner {
  max-width: var(--shell); margin: 0 auto;
  padding: 16px 28px 18px;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-title {
  margin: 0; font-size: 21px; font-weight: 650; letter-spacing: -.02em;
}
.page-sub { margin: 3px 0 0; font-size: 13.5px; color: var(--muted); }
.page-head-meta { font-size: 12.5px; color: var(--faint); }

/* ------------------------------------------------- prediction page */
.predict-panel-compact {
  grid-column: 1 / span 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
}
.predict-panel-compact a { text-decoration: none; }

.news-banner {
  grid-column: 1 / span 2;
  align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px;
  background: var(--warn-soft); border: 1px solid var(--warn);
  color: var(--warn); font-size: 13.5px; font-weight: 500;
}
.news-banner[hidden] { display: none; }
.news-banner:not([hidden]) { display: flex; }
.predict-panel .news-banner { grid-column: auto; margin-bottom: 16px; }

.predict-hero {
  display: flex; align-items: baseline; gap: 16px; padding: 26px;
  border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border);
}
.predict-hero.small { padding: 11px 18px; gap: 10px; border-radius: 10px; }
.predict-hero .predict-direction { font-size: 40px; font-weight: 750; letter-spacing: -.02em; }
.predict-hero.small .predict-direction { font-size: 21px; }
.predict-hero .predict-confidence { font-size: 16px; color: var(--muted); }
.predict-hero.buy  { border-color: var(--buy);  background: var(--buy-soft); }
.predict-hero.buy  .predict-direction { color: var(--buy); }
.predict-hero.sell { border-color: var(--sell); background: var(--sell-soft); }
.predict-hero.sell .predict-direction { color: var(--sell); }
.predict-hero.none .predict-direction { color: var(--muted); }

.predict-panel { text-align: left; }
.predict-price { margin: 18px 0; font-size: 15px; }
.predict-status { margin: 8px 0 16px; font-size: 13.5px; color: var(--muted); }
.predict-status.active { color: var(--accent); font-weight: 600; }
.reasons-list { margin: 0; padding-left: 20px; color: var(--text);
                font-size: 14.5px; line-height: 1.75; }
.reasons-list li::marker { color: var(--accent); }

/* ------------------------------------------------- sign in / sign up */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 16px; background: var(--bg);
}
.auth-shell {
  width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 32px rgba(20,25,34,.10), 0 2px 6px rgba(20,25,34,.05);
}

/* The pitch panel commits to one look rather than following the theme: it is
   a brand surface, and inverting it in dark mode made the accent unreadable
   against its own gradient. Both themes get the same deep ground. */
.auth-aside {
  position: relative; padding: 38px 36px;
  display: flex; flex-direction: column; gap: 26px;
  color: #E8EAEE;
  background:
    radial-gradient(130% 110% at 0% 0%, #2B3038 0%, #1B1F26 48%, #15181E 100%);
}
.auth-aside::after {           /* a single warm edge, the only flourish */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, #C89B3C, #8A6412 60%, transparent);
}
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand h1 {
  margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; color: #fff;
}
.auth-brand h1 span { color: #D6A646; font-weight: 500; }
.auth-brand .dot.live { background: #4FB47C; box-shadow: 0 0 0 3px rgba(79,180,124,.18); }

.auth-tagline {
  margin: 0; font-size: 21px; line-height: 1.35; font-weight: 600;
  letter-spacing: -.015em; color: #fff; max-width: 22ch; text-wrap: balance;
}

.auth-points { list-style: none; margin: 0; padding: 0;
               display: flex; flex-direction: column; gap: 18px; }
.auth-points li { display: flex; gap: 13px; align-items: flex-start; }
.auth-points svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: #D6A646; }
.auth-points b { display: block; font-size: 14px; font-weight: 600; color: #fff; }
.auth-points span { display: block; font-size: 13px; line-height: 1.5; color: #A8AEB8; margin-top: 2px; }

.auth-foot {
  margin: auto 0 0; font-size: 12px; line-height: 1.6; color: #868D98;
  border-top: 1px solid rgba(255,255,255,.09); padding-top: 16px;
}

.auth-form-wrap { padding: 38px 36px; display: flex; flex-direction: column; }
.auth-head h2 { margin: 0 0 5px; font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.auth-head p { margin: 0 0 22px; font-size: 14px; color: var(--muted); }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field input {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 11px 13px; color: var(--text);
  font-size: 15px; font-family: inherit; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* :user-invalid, not :invalid - it only matches AFTER the person has typed
   and left the field. With plain :invalid every empty required input is red
   the moment the page loads, so the form opens looking like four errors. */
.field input:user-invalid { border-color: var(--sell); }
.field input:user-invalid:focus { box-shadow: 0 0 0 3px var(--sell-soft); }

.hint { font-size: 12px; color: var(--faint); line-height: 1.45; }
.hint.bad { color: var(--sell); }
.hint.good { color: var(--buy); }

.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 62px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 6px 8px;
  font: 600 12.5px/1 var(--sans); color: var(--muted); border-radius: 6px;
}
.pw-toggle:hover { color: var(--text); background: var(--panel-2); }

.pw-meter { height: 4px; border-radius: 999px; background: var(--panel-2);
            border: 1px solid var(--border); overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0;
              background: var(--border-strong); transition: width .18s, background .18s; }
.pw-meter i.weak { background: var(--sell); }
.pw-meter i.fair { background: var(--warn); }
.pw-meter i.good { background: var(--buy); }

.btn-primary {
  margin-top: 6px; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 9px; padding: 12px;
  font: 700 15px/1.2 var(--sans); cursor: pointer;
  transition: filter .12s;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:focus-visible, .pw-toggle:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.auth-switch { margin: 22px 0 0; font-size: 14px; color: var(--muted); }
.auth-switch a { color: var(--accent); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-switch.muted-note { color: var(--faint); font-size: 13px; }

.alert {
  background: var(--sell-soft); border: 1px solid var(--sell); color: var(--sell);
  padding: 10px 13px; border-radius: 9px; font-size: 13.5px; margin-bottom: 18px;
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 460px; }
  /* The pitch panel becomes a header strip - keeping three bullet points
     above the fold on a phone pushes the actual form off the screen. */
  .auth-aside { padding: 24px 24px 22px; gap: 14px; }
  .auth-tagline { font-size: 17px; max-width: none; }
  .auth-points, .auth-foot { display: none; }
  .auth-form-wrap { padding: 26px 24px 30px; }
}

/* ------------------------------------------------- confidence interval */
.ci-wrap { padding: 4px 2px; }
.ci-track { position: relative; height: 36px; background: var(--panel-2);
            border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ci-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px;
           background: var(--border-strong); }
.ci-bar { position: absolute; top: 9px; height: 16px; border-radius: 8px; transition: all .4s; }
.ci-bar.good    { background: var(--buy-soft);  border: 1px solid var(--buy); }
.ci-bar.bad     { background: var(--sell-soft); border: 1px solid var(--sell); }
.ci-bar.neutral { background: var(--warn-soft); border: 1px solid var(--warn); }
.ci-mean { position: absolute; top: 4px; width: 2px; height: 26px;
           background: var(--text); transition: left .4s; }
.ci-labels { display: flex; justify-content: space-between; font-size: 11.5px;
             margin-top: 7px; color: var(--muted); }

/* ------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .ctx-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .nextcandle-panel, .indicators-panel, .context-panel,
  .chart-panel, .stats-panel, .feed-panel { grid-column: 1; }
  .nextcandle-panel { flex-wrap: wrap; gap: 16px; }
  .ind-grid { grid-template-columns: repeat(3, 1fr); }
  .ctx-grid { grid-template-columns: repeat(2, 1fr); }
  .panel.wide, .verdict-panel, .predict-panel-compact, .news-banner { grid-column: 1; }
  .verdict-panel { flex-wrap: wrap; gap: 16px; }
  .verdict-right { text-align: left; }
  .stats-grid.six { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand h1 { font-size: 15px; }
  .nav { gap: 2px; font-size: 13.5px; width: 100%; order: 3;
         overflow-x: auto; padding-bottom: 2px; }
  .nav a, .link-btn { padding: 5px 9px; }
  .price-block { margin-left: auto; }
  #live-price { font-size: 21px; }
  .layout { padding: 16px; gap: 14px; }
  .record-strip { margin: 16px; gap: 14px; font-size: 12px; }
  .rec-verdict { margin-left: 0; width: 100%; }
  .panel { padding: 16px; border-radius: 12px; }
  .ind-grid { grid-template-columns: repeat(2, 1fr); }
  .ctx-grid { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid.six { grid-template-columns: repeat(2, 1fr); }
  .nc-move { font-size: 23px; }
  .nc-arrow { font-size: 25px; }
  .nc-left { min-width: 0; }
  .verdict-pnl { font-size: 26px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px 7px; }
  .reason-cell { max-width: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------- EMA strategy panel */
.ema-live-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start;
}
.rules-title {
  margin: 0 0 10px; font-size: 11.5px; color: var(--faint);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}
.rules-wrap { border-left: 1px solid var(--border); padding-left: 24px; }
.rules-table { font-size: 13.5px; }
.rules-table td { padding: 9px 10px 9px 0; vertical-align: top; }
.rules-table td:first-child {
  width: 68px; min-width: 68px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
}
.ema-live-grid .ctx-sub { margin-top: 12px; }

/* The prediction page's "Why" list sits under a label, not a heading. */
.predict-panel .rules-title { margin-top: 22px; }

@media (max-width: 900px) {
  .ema-live-grid { grid-template-columns: 1fr; gap: 18px; }
  .rules-wrap { border-left: none; border-top: 1px solid var(--border);
                padding-left: 0; padding-top: 18px; }
}

@media (max-width: 640px) {
  .page-head-inner { padding: 13px 16px 15px; }
  .page-title { font-size: 18px; }
  .topbar { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 10px 16px; }
  /* A grid item defaults to min-width:auto, i.e. its content width. The nav is
     five links wide, so without this it stretched the whole topbar - and with
     it the body - past the viewport, and every panel below got clipped on the
     right. overflow-x on the nav only works once it is allowed to shrink. */
  .topbar > .nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch;
                   min-width: 0; }
  .topbar-right { grid-column: 2; grid-row: 1; }
}

/* The next-candle hero is a 3-part flex row. At phone width the meter in the
   middle kept it on one line and pushed "Full view" off-screen, which gave the
   whole page a horizontal scroll. Force the three parts onto their own rows. */
@media (max-width: 640px) {
  .nextcandle-panel { flex-direction: column; align-items: stretch; gap: 12px; }
  .nc-mid { flex: 1 1 100%; min-width: 0; }
  .nc-link { align-self: flex-start; }
  .verdict-panel { flex-direction: column; align-items: stretch; }
  body { overflow-x: hidden; }
}
