:root {
  --bg: #0a0d12;
  --panel: #12161d;
  --panel-in: #0c1016;      /* input / inset surfaces */
  --line: #1f2631;          /* card borders */
  --line-in: #232b36;       /* input borders */
  --line-soft: #1b212b;     /* header divider */
  --line-pill: #262d38;     /* pill / subtle borders */
  --ink: #e9edf3;
  --ink-strong: #eef1f6;    /* answer copy */
  --muted: #7f8a9a;
  --muted2: #8b95a5;
  --faint: #5c6675;
  --accent: #ffb224;
  --accent-hover: #ffc451;
  --accent-ink: #1a1200;
  --green: #2ebd85;
  --red: #f0616d;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: rgba(255, 178, 36, 0.28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-pill); border-radius: 8px; }

/* --- top bar --- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px 28px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 13, 18, 0.82); backdrop-filter: blur(12px);
}
.brand { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.tagline { color: var(--muted); font-size: 13.5px; letter-spacing: 0.01em; }

.account { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.whoami { font-family: var(--mono); font-size: 12px; color: var(--muted2); }
.linkbtn {
  background: transparent; border: 0; color: var(--muted2);
  font: inherit; font-size: 13px; cursor: pointer; padding: 0;
}
.linkbtn:hover { color: var(--ink); }

.authbox {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  max-width: 1060px; margin: 14px auto 0; padding: 12px 28px;
}
.authbox input {
  background: var(--panel-in); border: 1px solid var(--line-in); color: var(--ink);
  border-radius: 10px; padding: 10px 13px; font-size: 14px; min-width: 180px;
}
.authbox input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.authmsg { font-family: var(--mono); font-size: 12px; color: var(--red); }

.wrap { max-width: 1060px; margin: 0 auto; padding: 32px 28px 56px; }

/* --- controls --- */
.controls {
  display: flex; column-gap: 16px; row-gap: 30px; align-items: flex-end; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; flex: 1 1 150px; position: relative; }
.field span {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 500;
}
.field input {
  background: var(--panel-in); border: 1px solid var(--line-in); color: var(--ink);
  border-radius: 10px; padding: 12px 14px; font-family: var(--mono); font-size: 14px;
  width: 100%; color-scheme: dark;
}
#symbol { font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
#symbol::placeholder { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); }
.field input:focus { outline: 2px solid var(--accent); border-color: transparent; }
/* "Today" quick-set button, top-right of the Day field. */
.todaybtn {
  position: absolute; top: -1px; right: 0; padding: 0; line-height: 1;
  background: transparent; border: 0; color: var(--accent); cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.todaybtn:hover { color: var(--accent-hover); }

/* symbol autocomplete */
.symwrap { position: relative; }
.symsug {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  margin: 0; padding: 6px; list-style: none;
  background: var(--panel); border: 1px solid var(--line-in); border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5); max-height: 320px; overflow-y: auto;
}
.symsug li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.symsug li.active, .symsug li:hover { background: var(--panel-in); }
.symsug .sym { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); flex: none; }
.symsug .co { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.symsug .exch { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--faint); flex: none; }
/* Company hint sits BELOW the input, out of flow, so it never changes the
   field height (keeps all inputs aligned) or shifts on type. */
.symcompany {
  position: absolute; top: 100%; left: 2px; right: 0; margin-top: 5px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}

.go {
  margin-left: auto; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 13px 22px; font: inherit;
  font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.go:hover { filter: brightness(1.07); }
.go:disabled { opacity: 0.55; cursor: default; filter: none; }
.controls .go { height: 47px; }

/* --- chart card --- */
.chartcard {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 16px 12px;
}
.charttop {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 2px 4px 12px;
}
.charthint { font-size: 12.5px; color: var(--muted); }
.charttools { display: inline-flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.exttoggle {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  color: var(--muted2); cursor: pointer; user-select: none;
}
.exttoggle input { accent-color: var(--accent); cursor: pointer; width: 14px; height: 14px; }
.exttoggle.muted { opacity: 0.45; cursor: default; }

/* "Display" dropdown — collapses the chart overlay toggles behind one button so the
   toolbar shows just the dropdown + timezone + timeframe. */
.optdrop { position: relative; display: inline-flex; }
.optbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-in); color: var(--muted2);
  border: 1px solid var(--line-in); border-radius: 10px;
  padding: 7px 12px; font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: color 0.12s, border-color 0.12s;
}
.optbtn:hover { color: var(--ink); }
.optbtn.on { color: var(--ink); border-color: var(--accent); }
.optcount {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}
.optcount.hidden { display: none; }
.optchev { color: var(--faint); font-size: 10px; transition: transform 0.15s; }
.optdrop.open .optchev { transform: rotate(180deg); }
.optmenu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 2px; min-width: 210px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line-in); border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}
.optmenu.hidden { display: none; }
.optmenu .exttoggle {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border-radius: 8px; font-size: 13px;
}
.optmenu .exttoggle:hover { background: var(--panel-in); color: var(--ink); }
.optmenu .exttoggle .winlock { margin-left: auto; }

/* News time-window control (Pro-customizable). */
.winctl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted2); }
.winctl input {
  width: 52px; background: var(--panel-in); border: 1px solid var(--line-in); color: var(--ink);
  border-radius: 8px; padding: 5px 6px; font-family: var(--mono); font-size: 12px; text-align: right;
  color-scheme: dark;
}
.winctl input:disabled { opacity: 0.5; cursor: not-allowed; }
.winctl input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.winunit { color: var(--faint); }
.winlock { font-size: 10.5px; color: var(--accent); letter-spacing: 0.02em; }
.winlock.hidden { display: none; }

/* Shaded band on the chart showing the ±window the news is pulled from. */
.winband {
  position: absolute; top: 0; bottom: 0; z-index: 2; pointer-events: none;
  background: rgba(255, 178, 36, 0.10);
  border-left: 1px dashed rgba(255, 178, 36, 0.55);
  border-right: 1px dashed rgba(255, 178, 36, 0.55);
}
.winband.hidden { display: none; }
.intervals {
  display: inline-flex; gap: 4px; background: var(--panel-in);
  border: 1px solid var(--line-in); border-radius: 10px; padding: 4px;
}
.iv {
  background: transparent; color: var(--muted2); border: 0;
  border-radius: 7px; padding: 6px 13px; font-family: var(--mono);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.iv:hover { color: var(--ink); }
.iv.active { background: var(--accent); color: var(--accent-ink); }
.iv:disabled { color: var(--faint); opacity: 0.4; cursor: not-allowed; }
.iv:disabled:hover { color: var(--faint); }
.chartwrap { position: relative; }
.chart { height: 440px; width: 100%; cursor: crosshair; }
/* Floating "jump to today / latest bars" control, pinned to the plot's bottom-right.
   Shown only when the view is scrolled back or off today (toggled in app.js). */
.chartlatest {
  position: absolute; right: 14px; bottom: 14px; z-index: 4;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0 0 2px; border-radius: 999px;
  background: var(--panel-in); border: 1px solid var(--line-pill);
  color: var(--muted2); font-family: var(--mono); font-size: 18px; font-weight: 700;
  line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: background 0.12s, color 0.12s, border-color 0.12s, opacity 0.12s;
}
.chartlatest:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.chartlatest.hidden { display: none; }
/* Centered message shown over an empty plot (data too far back, no trading, …). */
.chartempty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; pointer-events: none;
}
.chartempty .msg {
  max-width: 44ch; color: var(--muted); font-size: 13.5px; line-height: 1.55;
  background: rgba(12, 16, 22, 0.72); border: 1px solid var(--line-in);
  border-radius: 12px; padding: 14px 18px;
}
/* Prominent, clickable upgrade card shown when the chart is locked (history too far
   back, or today's live data on a free plan). */
.chartlock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; pointer-events: none; z-index: 6;
}
.chartlock-card {
  pointer-events: auto; max-width: 40ch; display: flex; flex-direction: column;
  align-items: center; gap: 12px; padding: 26px 30px;
  background: rgba(12, 16, 22, 0.92); border: 1px solid var(--accent);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.chartlock-title { color: var(--ink-strong); font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.chartlock-msg { margin: 0; color: var(--muted2); font-size: 14px; line-height: 1.55; }
.chartlock-sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.chartlock .go { margin-top: 4px; }
.chartnote {
  display: flex; align-items: center; gap: 10px; font-family: var(--mono);
  font-size: 11.5px; color: var(--muted); margin: 12px 4px 2px; min-height: 1em;
}
.chartnote:not(:empty)::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}

/* --- result --- */
.result {
  margin-top: 16px; background: linear-gradient(180deg, #141922, #12161d);
  border: 1px solid #26303c; border-radius: 16px; padding: 24px;
}
.result.hidden { display: none; }
.answer { font-size: 19px; line-height: 1.62; letter-spacing: -0.005em; color: var(--ink-strong); max-width: 70ch; }
.answer.loading { color: var(--muted); }
.answer .cite {
  font-family: var(--mono); font-size: 0.72em; font-weight: 600; color: var(--accent);
  padding: 0 1px; vertical-align: 0.15em; white-space: nowrap;
}
.answer .cite:hover { color: var(--accent-hover); text-decoration: underline; }
.meta { margin-top: 16px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.debug {
  margin-top: 16px; padding: 12px; border: 1px dashed var(--muted); border-radius: 6px;
  font-family: var(--mono); font-size: 11px; line-height: 1.5; color: var(--muted);
  white-space: pre-wrap; word-break: break-word; overflow-x: auto; max-height: 340px; overflow-y: auto;
}
.sources { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sources li { display: flex; align-items: baseline; gap: 10px; }
.snum { font-family: var(--mono); font-size: 11px; color: #4d5765; flex: none; }
.sbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stitle { font-size: 13.5px; line-height: 1.45; color: var(--ink); word-break: break-word; }
a.stitle:hover { color: var(--accent); text-decoration: underline; }
.smeta { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.resultfoot {
  display: flex; align-items: center; gap: 14px;
  margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-in);
}
.wrong {
  background: transparent; color: var(--muted2); border: 1px solid var(--line-pill);
  border-radius: 9px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
.wrong:hover { border-color: var(--red); color: var(--red); }
.wrong.done { border-color: var(--green); color: var(--green); }
.share {
  background: transparent; color: var(--muted2); border: 1px solid var(--line-pill);
  border-radius: 9px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
.share:hover { border-color: var(--accent); color: var(--accent); }
.share.done { border-color: var(--green); color: var(--green); }
.share.busy { opacity: 0.6; cursor: progress; }
.likebtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--muted2); border: 1px solid var(--line-pill);
  border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.likebtn:hover { border-color: var(--red); color: var(--red); }
.likebtn.on { border-color: var(--red); color: var(--red); }
.likebtn .likeheart { font-size: 14px; line-height: 1; }
.likebtn .likecount { font-family: var(--mono); font-size: 12px; }
.libcard .llikes { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--red); }
.freeleft { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* Reused (cached/pinned) answer note + its "Run fresh" affordance. */
.cachednote {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 8px 12px; border-radius: 9px;
  background: var(--line-in); font-size: 13px; color: var(--muted2);
}
.cachednote .linkbtn { font-size: 13px; }

/* Owner-only curation controls in the result footer. */
.admincurate { display: inline-flex; gap: 10px; align-items: center; }
.admincurate .linkbtn {
  border: 1px solid var(--line-pill); border-radius: 9px; padding: 6px 12px; font-size: 13px;
}
.admincurate .linkbtn.on { border-color: var(--accent); color: var(--accent); }

/* --- share modal --- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal-card h2 { margin: 0 0 16px; font-size: 20px; }
.modal-x {
  position: absolute; top: 12px; right: 14px; background: transparent; border: 0;
  color: var(--muted2); font-size: 26px; line-height: 1; cursor: pointer; padding: 4px;
}
.modal-x:hover { color: var(--ink); }
.share-preview {
  border: 1px solid var(--line-in); border-radius: 12px; overflow: hidden;
  background: var(--panel-in); margin-bottom: 18px; min-height: 120px;
}
.share-preview img { display: block; width: 100%; height: auto; }
.share-linklabel {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 6px;
}
.share-linkrow { display: flex; gap: 8px; margin-bottom: 18px; }
.share-linkrow input {
  flex: 1; min-width: 0; background: var(--panel-in); border: 1px solid var(--line-in);
  color: var(--ink); border-radius: 10px; padding: 9px 12px; font-family: var(--mono); font-size: 13px;
}
.share-linkrow input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.share-nets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.netbtn {
  background: var(--panel-in); color: var(--ink); border: 1px solid var(--line-pill);
  border-radius: 9px; padding: 8px 13px; font: inherit; font-size: 13px; cursor: pointer;
}
.netbtn:hover { border-color: var(--accent); color: var(--accent); }
.share-imgrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding-top: 16px; border-top: 1px solid var(--line-in);
}
.sharemsg { font-family: var(--mono); font-size: 12px; color: var(--green); margin-left: auto; }

.fbform { margin-top: 12px; }
.fbnote {
  width: 100%; background: var(--panel-in); border: 1px solid var(--line-in); color: var(--ink);
  border-radius: 10px; padding: 10px 13px; font-size: 14px; font-family: inherit; resize: vertical;
}
.fbnote:focus { outline: 2px solid var(--accent); border-color: transparent; }
.fbactions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }

/* --- paywall (a modal popup; dismiss only via the ✕) --- */
.paywallcard { max-width: 720px; }
.paywallcard h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; padding-right: 28px; }
body.pw-open { overflow: hidden; } /* lock the background while the paywall is up */
.pwmsg { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tier {
  position: relative; background: var(--panel-in); border: 1px solid var(--line-in);
  border-radius: 12px; padding: 18px;
}
.tier-pro { border-color: var(--accent); }
.tier h3 { margin: 0 0 8px; font-size: 16px; }
.tierlead { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--ink); }
.tierdesc { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.tierfeatures { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.tierfeatures li { margin: 4px 0; }
.tiernote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.probadge {
  position: absolute; top: -10px; right: 14px; background: var(--accent);
  color: var(--accent-ink); font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
}
.pwnote { margin: 14px 0 0; color: var(--accent); font-size: 13px; min-height: 1em; }
@media (max-width: 560px) { .tiers { grid-template-columns: 1fr; } }

/* --- how it works --- */
.howitworks {
  margin-top: 22px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 24px;
}
.howitworks h2 { margin: 0 0 8px; font-size: 18px; letter-spacing: -0.01em; }
.howitworks p { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.howitworks em { color: var(--ink); font-style: normal; font-weight: 600; }
.examples { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exlabel { font-size: 13px; color: var(--muted); }
.ex {
  background: var(--panel-in); color: var(--ink); border: 1px solid var(--line-pill);
  border-radius: 999px; padding: 6px 13px; font-family: var(--mono); font-size: 12.5px; cursor: pointer;
}
.ex:hover { border-color: var(--accent); color: var(--accent); }

.disclaimer { margin-top: 26px; color: var(--faint); font-size: 12px; text-align: center; line-height: 1.6; }

.go.small { margin-left: 0; padding: 9px 14px; font-size: 13px; height: auto; }
.go.small.alt { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

.hidden { display: none !important; }

/* --- account suspended notice (#1) --- */
.bannednote {
  margin-bottom: 16px; padding: 12px 16px; border-radius: 12px;
  background: rgba(240, 97, 109, 0.12); border: 1px solid var(--red);
  color: var(--red); font-size: 13.5px;
}

/* --- "go Pro" banner above the chart, free/anon only (#3) --- */
.probanner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px; padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 178, 36, 0.14), rgba(255, 178, 36, 0.04));
  border: 1px solid var(--accent);
}
.probanner-txt { display: flex; flex-direction: column; gap: 2px; }
.probanner-txt strong { color: var(--ink-strong); font-size: 15px; }
.probanner-txt span { color: var(--muted2); font-size: 13px; }
.probanner .go { margin-left: auto; }

/* --- auth modal: tabs + validation + show-password (#7) --- */
.authcard { max-width: 420px; }
.authtabs {
  display: flex; gap: 6px; margin-bottom: 18px; background: var(--panel-in);
  border: 1px solid var(--line-in); border-radius: 12px; padding: 4px;
}
.authtab {
  flex: 1; background: transparent; color: var(--muted2); border: 0;
  border-radius: 9px; padding: 9px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.authtab.active { background: var(--accent); color: var(--accent-ink); }
.authsub { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fld > span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.09em; font-weight: 500; }
.fld input {
  background: var(--panel-in); border: 1px solid var(--line-in); color: var(--ink);
  border-radius: 10px; padding: 11px 13px; font-size: 14px; width: 100%;
}
.fld input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.pwwrap { position: relative; display: block; }
.pwwrap input { padding-right: 58px; }
.pwtoggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--muted2); font: inherit; font-size: 12px;
  cursor: pointer; padding: 4px 6px;
}
.pwtoggle:hover { color: var(--accent); }
.authsubmit { width: 100%; margin: 6px 0 0; }
.authcard .authmsg { display: block; margin: 12px 0 0; min-height: 1em; }

/* --- "what we asked the AI" transparency panel (#4) --- */
.promptpanel { margin-top: 16px; border-top: 1px solid var(--line-in); padding-top: 14px; }
.prompttoggle {
  background: transparent; border: 0; color: var(--muted2); font: inherit; font-size: 13px;
  cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 8px;
}
.prompttoggle:hover { color: var(--ink); }
.prompttoggle .chev { display: inline-block; transition: transform 0.15s; font-size: 11px; color: var(--accent); }
.prompttoggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.promptbody { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.promptseg { display: flex; flex-direction: column; gap: 5px; }
.plabel { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.promptseg pre {
  margin: 0; padding: 12px 14px; background: var(--panel-in); border: 1px solid var(--line-in);
  border-radius: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--muted2);
  white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto;
}
.prompttools { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* --- news-on-chart list under the chart (#9) --- */
.newslist { margin: 10px 4px 2px; display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.newshdr { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 8px 6px; }
.newsitem { display: flex; gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: 8px; }
.newsitem:hover { background: var(--panel-in); }
.newsitem .nt { font-family: var(--mono); font-size: 11px; color: var(--faint); flex: none; white-space: nowrap; }
.newsitem .ntitle { font-size: 13px; color: var(--ink); line-height: 1.45; word-break: break-word; }
.newsitem a.ntitle:hover { color: var(--accent); text-decoration: underline; }
.newsitem .ntag { font-family: var(--mono); font-size: 9.5px; padding: 1px 5px; border-radius: 5px; background: var(--line-in); color: var(--muted); flex: none; }
.newsitem .nnum { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--accent); flex: none; }
.newsitem.hl { background: rgba(255, 178, 36, 0.14); outline: 1px solid rgba(255, 178, 36, 0.4); border-radius: 6px; }

/* Fundamentals table — the Pro companion overlay under the chart. */
.fundlist { margin: 10px 4px 2px; max-height: 260px; overflow: auto; }
.fundlist.hidden { display: none; }
.fundhdr { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 8px 6px; }
.fundtable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.fundtable th, .fundtable td { text-align: right; padding: 4px 10px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.fundtable th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel); }
.fundtable th:first-child, .fundtable td:first-child { text-align: left; }
.fundtable td:first-child { color: var(--ink); }
.fundtable td { color: var(--muted2); }
.fundtable td.pos { color: var(--green); }
.fundtable td.neg { color: var(--red); }
.fundtable tr:hover td { background: var(--panel-in); }

/* Earnings beat/miss chip on the answer's meta line. */
.echip { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; font-family: var(--mono); font-size: 10.5px; }
.echip.beat { background: rgba(46, 189, 133, 0.14); color: var(--green); }
.echip.miss { background: rgba(240, 97, 109, 0.14); color: var(--red); }
.echip.inline { background: var(--line-in); color: var(--muted); }

/* Earnings chip → click-to-open "Earnings & revenue" detail popover. */
.earnwrap { position: relative; display: inline-block; }
button.echip { font: inherit; font-size: 10.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
button.echip:hover { filter: brightness(1.15); }
.echip-cav { font-size: 8px; opacity: 0.75; }
.earnpop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 240px; max-width: min(320px, 84vw);
  background: var(--panel); border: 1px solid var(--line-in); border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
  text-align: left; white-space: normal; cursor: default;
}
.earnpop.hidden { display: none; }
.earnpop-h { font-family: var(--sans); font-size: 13px; font-weight: 700; color: var(--ink-strong); letter-spacing: -0.01em; }
.earnpop-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 2px 0 8px; }
.earnpop-row { display: flex; align-items: baseline; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line-soft); }
.earnpop-row:first-of-type { border-top: 0; }
.earnpop .epk { flex: none; width: 82px; font-family: var(--sans); font-size: 12px; color: var(--muted2); }
.earnpop .epv { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.earnpop .epnote { color: var(--faint); font-size: 10.5px; font-style: normal; }
.earnpop .epbadge { font-weight: 700; }
.earnpop .epbadge.up { color: var(--green); }
.earnpop .epbadge.down { color: var(--red); }

/* Earnings "E" badges overlaid on the chart (Pro overlay) — a purple E per report,
   hover or tap for the EPS beat/miss detail. Sits on a top rail, above the candles. */
.earnpins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.earnpin {
  position: absolute; transform: translateX(-50%); pointer-events: auto; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  width: 21px; height: 21px; padding: 0; border-radius: 7px;
  background: rgba(139, 92, 246, 0.18); border: 1px solid #8b5cf6; color: #c9b8fb;
  font-family: var(--sans); font-size: 12px; font-weight: 800; line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); transition: background 0.12s, color 0.12s;
}
.earnpin:hover, .earnpin:focus-visible { background: #8b5cf6; color: #fff; outline: none; z-index: 4; }
.earntip.earntip { z-index: 6; } /* above the news tip when both overlays are on */
.earntip .eh { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.earntip .eh.up { color: var(--green); }
.earntip .eh.down { color: var(--red); }
.earntip .er { font-family: var(--mono); font-size: 11px; color: var(--muted2); margin-top: 3px; }

@media (pointer: coarse) {
  .earnpin { width: 27px; height: 27px; font-size: 14px; }
}

/* news pins overlaid on the chart — logo (X for tweets, newspaper otherwise) + number */
.newspins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.newsvline {
  position: absolute; top: 0; bottom: 0; width: 0; z-index: 4; pointer-events: none;
  border-left: 1px dashed rgba(255, 178, 36, 0.7);
}
.newspin {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: auto; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; max-width: 220px;
  background: var(--panel); border: 1px solid var(--line-in); border-radius: 999px;
  padding: 2px 8px 2px 6px; color: var(--muted2); font: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.newspin:hover { border-color: var(--accent); color: var(--ink); z-index: 4; }
.newspin svg { width: 13px; height: 13px; fill: currentColor; display: block; flex: none; }
.newspin.tweet { color: var(--ink); }
.newspin .pinnum { font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--accent); flex: none; }
.newspin .pinhead { font-size: 11px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- library section (#5) --- */
.librarysec {
  margin-top: 22px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 24px;
}
.librarysec h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.01em; }
.libintro { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.librarygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.libcard {
  text-align: left; background: var(--panel-in); border: 1px solid var(--line-in);
  border-radius: 12px; padding: 14px 16px; cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px; font: inherit;
}
.libcard:hover { border-color: var(--accent); }
.libcard .lh { display: flex; align-items: baseline; gap: 8px; }
.libcard .lsym { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--accent); }
.libcard .lwhen { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.libcard .lsum { font-size: 12.5px; color: var(--muted2); line-height: 1.5; }

/* explain button gated to 5m/1m + a selected minute (#6b) — clickable to show help */
.go.gated { opacity: 0.5; }

/* --- news hover tooltip on the chart (#9 interactivity) --- */
.newstip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 300px;
  background: rgba(12, 16, 22, 0.97); border: 1px solid var(--line-in);
  border-radius: 10px; padding: 9px 11px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.newstip .ttrow { margin-bottom: 8px; }
.newstip .ttrow:last-child { margin-bottom: 0; }
.newstip .tt { font-family: var(--mono); font-size: 10.5px; color: var(--faint); margin-bottom: 2px; }
.newstip .th { font-size: 12.5px; color: var(--ink); line-height: 1.4; }
.newstip .tmore { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* --- personal settings modal --- */
.settingssub { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.setrow {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--line-in);
}
.setrow:first-of-type { border-top: 0; }
.setlabel { display: flex; flex-direction: column; gap: 3px; }
.setlabel strong { font-size: 14px; color: var(--ink); font-weight: 600; }
.sethint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.setcheck { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; margin-top: 2px; }

/* =========================================================================
   i18n switcher · news-pin clusters · responsive/mobile · first-visit tour
   ========================================================================= */

/* --- language switcher in the top bar --- */
.langsel {
  background: transparent; border: 1px solid var(--line-pill); color: var(--muted2);
  border-radius: 8px; padding: 4px 6px; font: inherit; font-size: 12px; cursor: pointer;
  color-scheme: dark;
}
.langsel:hover { color: var(--ink); border-color: var(--accent); }
.langsel:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* --- clustered news pin (2+ items collapsed into a count badge) --- */
.newspin.cluster { border-color: var(--accent); color: var(--ink); background: rgba(255, 178, 36, 0.14); }
.newspin.cluster:hover { background: rgba(255, 178, 36, 0.24); }
.newspin .pincount {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
  flex: none; min-width: 13px; text-align: center;
}

/* --- bigger hit areas where the pointer is coarse (touch) --- */
/* News pins stay compact — they live on the bottom rail now, so enlarging them only put
   them back over the candles. Touch sizing here is limited to the controls. */
@media (pointer: coarse) {
  .iv, .tz, .optbtn, .netbtn, .todaybtn { min-height: 40px; display: inline-flex; align-items: center; }
  .exttoggle input, .setcheck { width: 20px; height: 20px; }
}

/* --- first real layout breakpoint: single-column phone layout --- */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .tagline { display: none; }
  .account { gap: 10px; flex-wrap: wrap; }
  .wrap { padding: 20px 14px 40px; }
  .controls { row-gap: 18px; column-gap: 12px; padding: 16px; align-items: stretch; }
  .field { flex: 1 1 100%; }
  .controls .go { width: 100%; margin-left: 0; }
  .charttop { margin: 2px 2px 10px; }
  .charthint { width: 100%; }
  .charttools { gap: 10px; width: 100%; }
  .chart { height: 340px; }
  .result { padding: 18px; }
  .answer { font-size: 17px; }
  .newslist { max-height: none; }
  .resultfoot { flex-wrap: wrap; gap: 10px; }
  .freeleft { margin-left: 0; width: 100%; }
  .modal { padding: 12px; }
  .modal-card { padding: 20px; }
}

/* --- first-visit tutorial (coach-marks) --- */
.tour-root { position: fixed; inset: 0; z-index: 60; }
.tour-backdrop { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.6); backdrop-filter: blur(1px); }
.tour-ring {
  position: fixed; z-index: 61; pointer-events: none; border-radius: 12px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 178, 36, 0.22), 0 0 22px rgba(255, 178, 36, 0.5);
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}
.tour-bubble {
  position: fixed; z-index: 62; width: min(320px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--accent); border-radius: 14px;
  padding: 16px 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}
.tour-title { font-size: 15px; font-weight: 700; color: var(--ink-strong); margin-bottom: 6px; }
.tour-body { font-size: 13.5px; color: var(--muted2); line-height: 1.55; }
.tour-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.tour-skip { font-size: 13px; }
