/* Edge Report — institutional, mobile-first, navy house style */
:root {
  --navy: #1f3864;
  --navy-ink: #152544;
  --navy-deep: #0f1c33;
  --paper: #f3f5f8;
  --card: #ffffff;
  --line: #d4dbe6;
  --line-strong: #b7c1d1;
  --muted: #5c6b80;
  --ink: #1a2332;
  --gold: #8a6d2c;
  --danger: #8b1e1e;
  --danger-bg: #f8ecec;
  --ok: #1b5c3c;
  --ok-bg: #e8f3ec;
  --pull: #6a4b16;
  --corr: #7a2e12;
  --up: #1f3864;
  --shadow: 0 1px 2px rgba(21, 37, 68, 0.06), 0 6px 18px rgba(21, 37, 68, 0.05);
  --font: "Segoe UI", "Source Sans 3", "Helvetica Neue", system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antigua", Georgia, serif;
  --mono: "IBM Plex Mono", "ui-monospace", "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1120px;
  --radius: 6px;
}
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy-ink); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy-ink); letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 1.85rem; margin: 0 0 0.4rem; font-weight: 650; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 0.35rem; }
h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy); margin: 0.8rem 0 0.2rem; font-family: var(--font); font-weight: 650; }
p { margin: 0 0 0.7rem; }
.skip {
  position: absolute; left: -999px; top: 0;
}
.skip:focus { left: 8px; background: #fff; padding: 6px 10px; z-index: 20; }

/* Header */
.top {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
}
.top-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.55rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border: 1px solid rgba(255,255,255,0.55);
  font-family: var(--serif); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--serif); font-size: 1rem; font-weight: 650; }
.brand-text em { font-style: normal; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.nav { display: flex; flex-wrap: wrap; gap: 0.15rem 0.2rem; }
.nav a {
  color: #e8edf5; text-decoration: none;
  padding: 0.35rem 0.55rem; border-radius: 4px; font-size: 0.92rem;
}
.nav a[aria-current="page"], .nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.45);
  padding: 0.35rem 0.7rem; border-radius: 4px; font: inherit;
}
.top-right { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }
.week-picker { display: flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: #d5dce8; }
.week-picker select, select, input, textarea, button {
  font: inherit; color: inherit;
}
.week-picker select {
  background: var(--navy-ink); color: #fff; border: 1px solid rgba(255,255,255,0.3);
  padding: 0.3rem 0.4rem; border-radius: 4px;
}
.logout button {
  background: transparent; color: #e8edf5; border: 1px solid rgba(255,255,255,0.35);
  padding: 0.3rem 0.6rem; border-radius: 4px; cursor: pointer;
}
.logout button:hover { background: rgba(255,255,255,0.1); }

main { flex: 1; max-width: var(--max); width: 100%; margin: 0 auto; padding: 1.4rem 1rem 3rem; }
.page-head { margin-bottom: 1.2rem; }
.eyebrow {
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--gold); font-weight: 650; margin: 0 0 0.25rem;
}
.lede { font-size: 1.05rem; color: var(--muted); max-width: 46rem; }
.muted { color: var(--muted); }
.fine { font-size: 0.8rem; color: var(--muted); }
.meta { font-size: 0.88rem; color: var(--muted); }
.pill {
  display: inline-block; background: var(--navy); color: #fff;
  padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.75rem;
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: 650; margin: 0;
}
.btn {
  display: inline-block; background: #fff; color: var(--navy);
  border: 1px solid var(--navy); padding: 0.45rem 0.85rem;
  border-radius: 4px; text-decoration: none; cursor: pointer; font: inherit;
}
.btn:hover { background: #eef2f8; color: var(--navy-ink); }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-ink); color: #fff; }
.btn.quiet { border-color: var(--line-strong); color: var(--muted); }

.banner, .caution-banner {
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--gold);
  padding: 0.9rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 0 0 1.2rem;
}
.banner.err { border-left-color: var(--danger); background: var(--danger-bg); }
.flag, .banner-flag {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid #e3c4c4; padding: 0.45rem 0.7rem; border-radius: 4px; font-size: 0.9rem;
}
.flag.tight { display: inline-block; padding: 0.15rem 0.4rem; font-size: 0.78rem; }

/* Market panels / regime */
.market-grid, .split, .stock-layout, .exec, .cards {
  display: grid; gap: 1rem;
}
.market-grid, .split, .stock-layout, .exec { grid-template-columns: 1fr; }
.market-panel, .stock-card, .week-block, .login-card, .method-edge {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem;
}
.market-panel header { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.market-panel h2 { margin-top: 0; }
.market-panel h2 a { color: inherit; text-decoration: none; }
.regime-line, .regime-kpis { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--muted); font-size: 0.92rem; }
.regime-banner {
  background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--navy);
  padding: 1rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.1rem; box-shadow: var(--shadow);
}
.regime-banner.reg-up { border-left-color: var(--ok); }
.regime-banner.reg-pull { border-left-color: var(--gold); }
.regime-banner.reg-corr, .regime-banner.reg-crash { border-left-color: var(--corr); }
.exec-regime { margin: 0.6rem 0 0; }
.top-ideas { margin: 0; padding-left: 1.15rem; }
.top-ideas li { margin: 0 0 0.35rem; }
.plain { margin: 0; padding-left: 1.15rem; }
.caution { background: #fbf6ea; border: 1px solid #ead9a8; border-radius: var(--radius); padding: 0.7rem 0.9rem; }
.caution h2 { margin-top: 0; }

.market-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; margin: 0.4rem 0 0; }
.market-switch a { padding: 0.35rem 0.8rem; text-decoration: none; color: var(--navy); background: #fff; }
.market-switch a.on { background: var(--navy); color: #fff; }

/* Filters and jump nav */
.filters {
  display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: end;
  background: #fff; border: 1px solid var(--line); padding: 0.8rem 1rem;
  border-radius: var(--radius); margin: 1rem 0;
}
.filters label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); letter-spacing: 0.02em; }
.filters select, .note-form textarea, .login-card input {
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 0.4rem 0.5rem; background: #fff; color: var(--ink); min-height: 2.4rem;
}
.filters .chk { flex-direction: row; align-items: center; gap: 0.4rem; min-height: 2.4rem; color: var(--ink); font-size: 0.95rem; }
.jump {
  display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 1.2rem;
  position: sticky; top: 3.4rem; background: var(--paper); padding: 0.4rem 0; z-index: 5;
}
.jump a {
  font-size: 0.78rem; text-decoration: none; border: 1px solid var(--line);
  background: #fff; color: var(--navy); padding: 0.2rem 0.4rem; border-radius: 3px;
}
.jump a.has { border-color: var(--navy); }
.jump a.empty { color: var(--muted); }
.jump small { color: var(--muted); font-size: 0.7rem; }

/* Edge sections and cards */
.edge-sec { margin: 0 0 2rem; padding-top: 0.4rem; scroll-margin-top: 7rem; }
.edge-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem; align-items: baseline; }
.edge-head h2 { margin: 0; }
.edge-head h2 span { font-weight: 500; color: var(--ink); }
.defn { color: var(--muted); font-size: 0.95rem; max-width: 52rem; }
.zero { font-style: italic; color: var(--muted); }
.cards { grid-template-columns: 1fr; }
.stock-card header { background: var(--navy); color: #fff; margin: -1rem -1.1rem 0.9rem; padding: 0.7rem 1.1rem; border-radius: var(--radius) var(--radius) 0 0; }
.stock-card header h3 { margin: 0; color: #fff; font-size: 1.1rem; }
.stock-card header a { color: #fff; text-decoration: none; }
.stock-card header a:hover { text-decoration: underline; }
.stock-card .sub { margin: 0.15rem 0 0; font-size: 0.85rem; opacity: 0.85; }
.keydata { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 0.8rem; margin: 0 0 0.8rem; }
.keydata.big { grid-template-columns: 1fr 1fr; }
.keydata dt { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.keydata dd { margin: 0; font-variant-numeric: tabular-nums; }
.keydata .src { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.other, .src-list { font-size: 0.85rem; color: var(--muted); }
.chart {
  margin: 1rem 0 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}
.chart.large { margin: 1.2rem 0 1rem; }
.chart figcaption { font-size: 0.78rem; color: var(--muted); padding: 0.35rem 0.7rem 0.55rem; }
.chart-zoom {
  display: block;
  position: relative;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
  background: #fff;
}
.chart-zoom:hover, .chart-zoom:focus { color: inherit; }
.chart-zoom:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.chart-frame { display: block; background: #fff; }
.chart-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #fff;
  vertical-align: top;
}
.chart-zoom-hint {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  background: rgba(15, 28, 51, 0.8);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.hint-tap { display: none; }
.chart-zoom:hover .chart-zoom-hint,
.chart-zoom:focus-visible .chart-zoom-hint { opacity: 1; }
/* Card previews are half-width; keep the enlarge hint visible. */
.chart:not(.large) .chart-zoom-hint { opacity: 0.92; }
.chart-lightbox-bar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 82;
  background: transparent;
}
.chart-lightbox-hint { display: none; margin: 0; }
.chart-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

/* Lightbox: native-size, pannable on a phone so labels stay readable */
.chart-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 28, 51, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.4rem 1rem 1rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.chart-lightbox[hidden] { display: none; }
.chart-lightbox img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(1140px, calc(100vw - 2rem));
  max-height: calc(100vh - 3.4rem);
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
}
.chart-lightbox-close {
  position: fixed;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 81;
  background: #fff;
  color: var(--navy-ink);
  border: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.chart-lightbox-close:hover { background: #eef2f8; }
body.lightbox-open { overflow: hidden; }
.table-title { margin-top: 1.1rem; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.hits { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.hits th, table.hits td {
  text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.hits th {
  background: #e8edf4; color: var(--navy-ink); font-size: 0.72rem;
  letter-spacing: 0.05em; text-transform: uppercase; font-weight: 650; position: sticky; top: 0;
}
table.hits tr:last-child td { border-bottom: 0; }
table.hits tr.new td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
table.hits.nums td, table.hits.nums th { font-variant-numeric: tabular-nums; }
table.hits td.mcap, table.hits td[data-th="Mkt cap"] { white-space: nowrap; }
.tag {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.03em;
  background: #e8edf4; color: var(--navy); padding: 0.05rem 0.35rem; border-radius: 3px;
}

/* Stock page */
.stock-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }
.ticker { font-family: var(--mono); font-size: 1.1rem; color: var(--muted); margin: 0; }
.watch-form { margin: 0.5rem 0 0; }
.note-form textarea { width: 100%; min-height: 8rem; }
.week-block { margin-bottom: 0.8rem; }
.edge-list { list-style: none; padding: 0; margin: 0 0 0.6rem; }
.edge-list li { margin: 0 0 0.6rem; }
.edge-list p { margin: 0.2rem 0 0; }

/* Login */
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(180deg, var(--navy-deep) 0 40%, var(--paper) 40%);
}
.login-card { width: min(100%, 26rem); padding: 1.4rem 1.3rem 1.1rem; }
.login-brand { margin-bottom: 1rem; color: var(--navy); }
.login-brand .brand-mark { border-color: var(--navy); color: var(--navy); }
.login-card h1 { margin-bottom: 0.3rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.7rem; margin: 1rem 0; }
.login-card label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.login-card .btn { width: 100%; text-align: center; padding: 0.65rem; }

.method-edge { margin-bottom: 0.7rem; }
.method-edge h3 { margin-top: 0; font-size: 1rem; }

.site-footer {
  border-top: 1px solid var(--line);
  background: #fff; color: var(--muted);
  padding: 1rem; text-align: center; font-size: 0.85rem;
}
.site-footer p { margin: 0 0 0.3rem; }
code { font-family: var(--mono); font-size: 0.88em; }


.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.8rem; margin: 0.5rem 0 0.2rem; }
.disclaimer { margin-top: 1.1rem; font-size: 0.9rem; color: var(--muted); }
.theme-block { margin: 0.8rem 0 1rem; }
.exec-full { margin-bottom: 1.8rem; }
.exec-full h2 { margin-top: 0; }

/* Wider screens */
@media (min-width: 800px) {
  html { font-size: 16px; }
  h1 { font-size: 2.05rem; }
  .market-grid, .split, .stock-layout, .exec { grid-template-columns: 1fr 1fr; }
  .exec { grid-template-columns: 1.2fr 1fr 0.9fr; }
  .cards { grid-template-columns: 1fr 1fr; }
  .keydata.big { grid-template-columns: 1fr 1fr 1fr; }
  .stock-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.5rem 0.8rem; }
  .stock-head .eyebrow, .stock-head .stock-title { flex: 1 1 100%; }
  .stock-head .watch-form { margin-left: auto; }
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

/* Phone: stacked tables, larger tap targets, compact header */
@media (max-width: 720px) {
  html { font-size: 17px; }
  .nav-toggle { display: inline-block; }
  .nav { display: none; width: 100%; flex-direction: column; }
  .top.is-open .nav { display: flex; }
  .top-right { width: 100%; justify-content: space-between; }
  .jump { top: 0; position: static; }
  main { padding: 1rem 0.8rem 2.4rem; }
  h1 { font-size: 1.6rem; }
  .keydata, .keydata.big { grid-template-columns: 1fr 1fr; }
  /* Phone: keep table structure; one line per row; scroll sideways. Cards stack. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.hits { min-width: max-content; width: max-content; }
  table.hits th, table.hits td { white-space: nowrap; }
  .cards { grid-template-columns: 1fr; }
  .btn, .filters select, .filters .chk, .logout button, .nav a { min-height: 2.6rem; display: inline-flex; align-items: center; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters label, .filters select, .filters .btn { width: 100%; }
  .head-actions { flex-direction: column; align-items: stretch; }
  .head-actions .btn { text-align: center; justify-content: center; }
  /* Show the whole series in-page; tap the chart to enlarge and read labels. */
  .chart-zoom-hint { opacity: 1; }
  .hint-click { display: none; }
  .hint-tap { display: inline; }
  .chart-lightbox {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    overflow: hidden;
  }
  .chart-lightbox-bar {
    position: static;
    flex: 0 0 3.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    height: 3.2rem;
    padding: 0 0.5rem 0 0.9rem;
    background: rgba(15, 28, 51, 0.96);
    color: #fff;
  }
  .chart-lightbox-hint {
    display: block;
    font-size: 0.8rem;
    margin: 0;
  }
  .chart-lightbox-stage {
    flex: 1 1 auto;
    display: block;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.4rem 0 1.2rem;
  }
  .chart-lightbox img {
    max-width: none;
    max-height: none;
    width: 1000px;
    margin: 0.4rem 0.6rem 1.2rem;
    border-radius: 4px;
  }
  .chart-lightbox-close {
    position: static;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
  }
}
