/* ============================================================
   NDP Trading INC. — Financial Terminal Design System
   Self-contained, no external dependencies.
   ============================================================ */

:root {
  /* Core palette — terminal dark */
  --bg-0: #0a0e17;          /* page background */
  --bg-1: #0f1523;          /* panels */
  --bg-2: #161d2e;          /* raised panels / rows */
  --bg-3: #1e2740;          /* hover / active */
  --line: #232c44;          /* borders */
  --line-soft: #1a2236;

  --text-0: #e8edf7;        /* primary text */
  --text-1: #9aa7c2;        /* secondary text */
  --text-2: #5f6d8c;        /* muted / labels */

  /* Market colors */
  --up: #17c964;            /* gains */
  --up-dim: #0e7a3d;
  --down: #ff4d5e;          /* losses */
  --down-dim: #b02330;
  --flat: #8a97b4;

  /* Accent — brand */
  --accent: #ffb020;        /* amber ticker gold */
  --accent-2: #4d9fff;      /* electric blue */
  --accent-glow: rgba(255, 176, 32, 0.15);

  /* Layout metrics */
  --nav-h: 60px;
  --ticker-h: 44px;
  --maxw: 1360px;

  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Consolas, "Roboto Mono", monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(77, 159, 255, 0.06), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(255, 176, 32, 0.05), transparent 55%),
    var(--bg-0);
  color: var(--text-0);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* Room for fixed nav (top) + ticker (bottom) */
  padding-top: var(--nav-h);
  padding-bottom: var(--ticker-h);
  min-height: 100%;
}

a { color: inherit; text-decoration: none; }

.tnum { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ============================================================
   TOP NAVIGATION — static toolbar across all pages
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h);
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; height: 100%;
  padding: 0 22px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #ff7a18);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 15px; color: #1a1200;
  box-shadow: 0 0 18px var(--accent-glow);
}
.brand__name { font-weight: 700; letter-spacing: 0.2px; font-size: 16px; }
.brand__name span { color: var(--accent); }

.nav__links { display: flex; align-items: center; gap: 4px; margin-left: 6px; }
.nav__links a {
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--text-1); font-weight: 500; font-size: 14px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav__links a:hover { color: var(--text-0); background: var(--bg-2); }
.nav__links a.active { color: var(--text-0); background: var(--bg-3); }
.nav__links a.active::before { content: "▸ "; color: var(--accent); }

.nav__right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.market-clock {
  display: flex; align-items: center; gap: 13px; justify-content: flex-end;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-1);
}
.market-clock .mkt { display: inline-flex; align-items: center; white-space: nowrap; }
.market-clock .mkt-time {
  color: var(--text-2);
  margin-left: 4px; padding-left: 16px;
  border-left: 1px solid var(--line);
}
.market-clock .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--up); margin-right: 6px; vertical-align: middle;
  box-shadow: 0 0 8px var(--up);
}
.market-clock .dot.closed { background: var(--down); box-shadow: 0 0 8px var(--down); }

.nav__toggle { display: none; background: none; border: 0; color: var(--text-0); font-size: 22px; cursor: pointer; }

/* ============================================================
   SCROLLING TICKER — static footer across all pages
   ============================================================ */
.ticker {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--ticker-h);
  z-index: 100;
  background: linear-gradient(180deg, #0c1120, #070a12);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; overflow: hidden;
}
.ticker__label {
  flex-shrink: 0; height: 100%; display: flex; align-items: center; gap: 7px;
  padding: 0 16px; background: var(--accent); color: #1a1200;
  font-family: var(--mono); font-weight: 800; font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; z-index: 2;
  box-shadow: 6px 0 18px rgba(0,0,0,.5);
}
.ticker__viewport { flex: 1; overflow: hidden; height: 100%; position: relative; }
.ticker__track {
  display: flex; align-items: center; height: 100%;
  gap: 34px; white-space: nowrap; width: max-content;
  animation: ticker-scroll var(--ticker-speed, 60s) linear infinite;
}
.ticker:hover .ticker__track { animation-play-state: paused; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.tk { display: inline-flex; align-items: baseline; gap: 8px; font-size: 13px; }
.tk__sym { font-weight: 700; font-family: var(--mono); color: var(--text-0); }
.tk__px  { font-family: var(--mono); color: var(--text-1); }
.tk__chg { font-family: var(--mono); font-size: 12px; }
.tk__arrow { font-size: 10px; }

/* ============================================================
   GENERIC PANELS / CARDS
   ============================================================ */
.panel {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.panel__title { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-1); }
.panel__title .accent { color: var(--accent); }

.section-title {
  font-size: 22px; font-weight: 700; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 10px;
}
.section-title .bar { width: 4px; height: 22px; background: var(--accent); border-radius: 2px; }
.section-sub { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }

.updated-tag { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-0);
  font-weight: 600; font-size: 13.5px; cursor: pointer; transition: all .15s;
}
.btn:hover { background: var(--bg-3); border-color: var(--accent-2); }
.btn--accent { background: var(--accent); color: #1a1200; border-color: var(--accent); }
.btn--accent:hover { filter: brightness(1.08); }

/* ============================================================
   HERO (main page)
   ============================================================ */
.hero { padding: 46px 0 30px; }
.hero__grid { max-width: 780px; }
.hero__eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.hero h1 { font-size: 44px; line-height: 1.06; letter-spacing: -1px; margin-bottom: 16px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p.lead { color: var(--text-1); font-size: 16.5px; max-width: 560px; margin-bottom: 24px; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

.index-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.index-card__row { display: flex; align-items: center; justify-content: space-between; padding: 11px 4px; border-bottom: 1px dashed var(--line-soft); }
.index-card__row:last-child { border-bottom: 0; }
.index-card__name { font-weight: 600; }
.index-card__name small { display: block; color: var(--text-2); font-size: 11.5px; font-weight: 400; }
.index-card__px { text-align: right; }
.index-card__px .p { font-family: var(--mono); font-size: 16px; font-weight: 600; }
.index-card__px .c { font-family: var(--mono); font-size: 12.5px; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 8px 0 30px; }
.stat {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.stat__label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-2); }
.stat__value { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 6px; }
.stat__delta { font-family: var(--mono); font-size: 12.5px; margin-top: 2px; }

/* Movers grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mover-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 11px 18px; border-bottom: 1px solid var(--line-soft);
}
.mover-row:last-child { border-bottom: 0; }
.mover-row:hover { background: var(--bg-2); }
.mover-sym { font-family: var(--mono); font-weight: 700; }
.mover-sym small { display:block; font-weight: 400; color: var(--text-2); font-size: 11px; font-family: var(--sans); }
.mover-px { font-family: var(--mono); text-align: right; color: var(--text-1); }
.mover-chg { font-family: var(--mono); text-align: right; font-weight: 600; min-width: 78px; }

/* Section spacing */
.stack { display: flex; flex-direction: column; gap: 30px; }
.block { margin-top: 34px; }
.block__head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }

/* ============================================================
   NEWS PAGE
   ============================================================ */
.news-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 7px 14px; border-radius: 100px; border: 1px solid var(--line);
  background: var(--bg-1); color: var(--text-1); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent-2); color: var(--text-0); }
.chip.active { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 700; }

.news-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.news-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .15s, border-color .15s;
}
.news-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.news-card__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--text-1);
}
.tag--sent-bullish { color: var(--up); border-color: var(--up-dim); }
.tag--sent-bearish { color: var(--down); border-color: var(--down-dim); }
.tag--sent-neutral { color: var(--text-1); }
.news-card__time { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.news-card h3 { font-size: 17px; line-height: 1.3; letter-spacing: -.2px; }
.news-card p { color: var(--text-1); font-size: 13.8px; line-height: 1.5; }
.news-card__foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 6px; }
.news-card__src { font-size: 12px; color: var(--text-2); }
.news-card__tickers { display: flex; gap: 6px; margin-left: auto; }
.pill {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; background: var(--bg-3); color: var(--accent-2);
}
.news-card__read { font-size: 12.5px; color: var(--accent-2); font-weight: 600; }

/* ============================================================
   EARNINGS PAGE — tabular by date
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); }
table.earn { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 820px; }
table.earn thead th {
  position: sticky; top: var(--nav-h); z-index: 5;
  background: var(--bg-2); text-align: left; padding: 13px 16px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--text-2);
  border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap;
}
table.earn th.num, table.earn td.num { text-align: right; font-family: var(--mono); }
.earn__daterow td {
  background: var(--bg-0); padding: 10px 16px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .5px;
  color: var(--accent); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-soft);
  font-weight: 700; text-transform: uppercase;
}
.earn__daterow td .count { color: var(--text-2); font-weight: 400; margin-left: 8px; text-transform: none; }
table.earn tbody tr.earn__row td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.earn tbody tr.earn__row:hover td { background: var(--bg-2); }
.earn__sym { font-family: var(--mono); font-weight: 700; font-size: 14.5px; }
.earn__name { color: var(--text-2); font-size: 12px; }
.time-badge {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 7px; border-radius: 4px; border: 1px solid var(--line);
}
.time-badge.bmo { color: var(--accent-2); border-color: #2a4a6e; }
.time-badge.amc { color: var(--accent); border-color: #6e5320; }
.status {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 100px;
}
.status.reported { background: rgba(23,201,100,.12); color: var(--up); }
.status.upcoming { background: rgba(77,159,255,.12); color: var(--accent-2); }
.beat { color: var(--up); font-weight: 700; }
.miss { color: var(--down); font-weight: 700; }
.report-link { color: var(--accent-2); font-weight: 600; font-size: 12.5px; }
.report-link.none { color: var(--text-2); font-weight: 400; }

/* ============================================================
   WATCHLIST (main page)
   ============================================================ */
.wl-actions { display: flex; gap: 8px; }
.wl-addbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 18px; border-bottom: 1px solid var(--line-soft);
}
.wl-input {
  flex: 1; min-width: 200px; max-width: 340px;
  background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-0); font-family: var(--mono); font-size: 14px;
  padding: 10px 13px; text-transform: uppercase; letter-spacing: .5px;
}
.wl-input::placeholder { color: var(--text-2); text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.wl-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wl-msg { font-size: 13px; font-family: var(--mono); }
.wl-msg.ok { color: var(--up); }
.wl-msg.err { color: var(--down); }

.wl-table { min-width: 560px; }
/* The watchlist table sits on the scrolling Markets page and is short. It reuses
   the .earn class, which makes the header `position: sticky` (correct for the long
   earnings table). Here that sticky header floats DOWN over the rows and hides
   them — so force it static. Only the earnings-page table keeps a sticky header. */
table.earn.wl-table thead th { position: static; top: auto; z-index: auto; }
.wl-star { color: var(--accent); margin-right: 7px; font-size: 12px; }
.wl-row--nodata .earn__name { color: var(--down); opacity: .8; }
.wl-livetag { color: var(--up); font-family: var(--mono); font-size: 11px; }
.tag--nodata { color: var(--text-2); border-color: var(--line); }
.wl-remove {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 12px;
  line-height: 1; transition: all .15s;
}
.wl-remove:hover { background: var(--down-dim); border-color: var(--down); color: #fff; }
.wl-foot { padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.wl-hint { font-size: 12.5px; color: var(--text-2); }
.wl-hint code { font-family: var(--mono); color: var(--accent-2); background: var(--bg-0); padding: 1px 5px; border-radius: 4px; }
.wl-hint strong { color: var(--text-1); }

/* Ticker star + news pill / earnings row highlight for watchlist items */
.tk__star { color: var(--accent); font-size: 10px; margin-right: 2px; }
.pill--wl { background: var(--accent); color: #1a1200; }
.earn__row--wl td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ============================================================
   LOGIN / UNAUTHORISED PAGES
   ============================================================ */
.login-body { padding: 0; display: grid; place-items: center; min-height: 100vh; }
.login-wrap { width: 100%; max-width: 480px; padding: 32px 22px; }
.login-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px 32px;
}
.login-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 22px; }
.login-welcome {
  color: var(--text-1); font-size: 14px; line-height: 1.6;
  background: var(--bg-0); border: 1px solid var(--line-soft); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 26px;
}
.login-form { display: flex; flex-direction: column; }
.login-label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-2); margin-bottom: 6px; font-weight: 700;
}
.login-input {
  background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text-0); font-family: var(--mono); font-size: 15px;
  padding: 11px 13px; margin-bottom: 18px; width: 100%;
}
.login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.login-btn { justify-content: center; width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-msg { min-height: 20px; margin-top: 12px; font-size: 13px; text-align: center; }
.login-msg.err { color: var(--down); }
.login-foot { margin-top: 22px; text-align: center; color: var(--text-2); font-size: 11.5px; }

.nav__logout {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1);
  padding: 6px 13px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12.5px; font-weight: 600; font-family: var(--sans); transition: all .15s;
}
.nav__logout:hover { background: var(--bg-3); border-color: var(--down); color: var(--down); }

.unauth-wrap { width: 100%; max-width: 720px; padding: 40px 22px; text-align: center; }
.unauth-title {
  color: #ff2233; font-size: clamp(30px, 6vw, 60px); font-weight: 800;
  letter-spacing: -0.5px; line-height: 1.1; margin-bottom: 30px;
  text-shadow: 0 0 26px rgba(255, 34, 51, .45);
}
.unauth-card {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border: 1px solid var(--down-dim); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.unauth-text { color: var(--text-1); font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
.unauth-text--muted { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

/* ============================================================
   FOOTER (content footer, above the fixed ticker)
   ============================================================ */
.site-foot { border-top: 1px solid var(--line); margin-top: 56px; padding: 30px 0 40px; }
.site-foot__grid { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; color: var(--text-2); font-size: 13px; }
.site-foot a:hover { color: var(--text-0); }
.disclaimer { color: var(--text-2); font-size: 11.5px; max-width: 620px; line-height: 1.5; }

/* ============================================================
   STATES
   ============================================================ */
.loading { color: var(--text-2); font-family: var(--mono); font-size: 13px; padding: 24px; text-align: center; }
.empty { color: var(--text-2); padding: 30px; text-align: center; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .hero__grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .nav__links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; background: var(--bg-1); border-bottom: 1px solid var(--line); padding: 10px; gap: 2px; }
  .nav__links.open { display: flex; }
  .nav__toggle { display: block; margin-left: auto; }
  .nav__right { display: none; }
  .hero h1 { font-size: 32px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .section-title { font-size: 19px; }
}
