/* ------------------------------------------------------------------
   Index Data Store — design system
   Grounded in the NSE NEAT terminal era: paper-white sheets, deep
   navy ink, terminal blue actions, and the yellow highlighted quote
   row as the house signature. All numerals set in mono.
------------------------------------------------------------------- */

:root {
  --paper: #f7f8fb;      /* cool off-white ground */
  --sheet: #ffffff;      /* card / table surface */
  --ink: #111b3f;        /* near-navy text */
  --ink-soft: #565f7d;   /* secondary text */
  --rule: #d8dce8;       /* hairlines */
  --blue: #1f3bb3;       /* NEAT terminal blue — actions & links */
  --blue-deep: #162b85;
  --blue-wash: #eef1fb;
  --hl: #ffd84d;         /* NEAT yellow — the highlighted row */
  --up: #0e7c4a;
  --down: #c43d2e;
  --radius: 5px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Archivo", -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 40px 24px 88px; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; border-radius: 2px; }

/* ---------- type ---------- */

h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  font-weight: 800;
  font-stretch: 115%;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin-bottom: 10px;
}
h2 {
  font-size: 1.25rem;
  font-weight: 700;
  font-stretch: 110%;
  margin: 44px 0 14px;
}
h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }

p.lead { color: var(--ink-soft); max-width: 620px; font-size: 1.05rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  display: block;
  margin-bottom: 10px;
}

.mono, td.num, .tape { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

/* the signature: yellow quote-row highlight */
.hl {
  background: var(--hl);
  color: var(--ink);
  padding: 0 5px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- masthead ---------- */

nav {
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
  padding: 16px 28px;
  background: var(--sheet);
  border-bottom: 2px solid var(--ink);
}
nav .brand {
  font-weight: 800; font-stretch: 120%;
  font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--ink); display: inline-flex; align-items: center; gap: 9px;
}
nav .brand:hover { text-decoration: none; }
nav .brand .mark {
  width: 15px; height: 15px; background: var(--hl);
  border: 2px solid var(--ink); display: inline-block;
}
nav a.nav-link {
  color: var(--ink-soft);
  font-family: var(--mono); font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
nav a.nav-link:hover { color: var(--blue); text-decoration: none; }
nav .spacer { flex: 1; }

footer {
  border-top: 1px solid var(--rule);
  background: var(--sheet);
  padding: 22px 28px;
  color: var(--ink-soft);
  font-family: var(--mono); font-size: 0.78rem;
}

/* ---------- coverage tape ---------- */

.tape {
  overflow: hidden; white-space: nowrap;
  background: var(--ink); color: var(--paper);
  border-bottom: 1px solid var(--ink);
  font-size: 0.78rem;
  user-select: none;
}
.tape-inner { display: inline-block; padding: 8px 0; animation: tape-scroll 45s linear infinite; }
.tape:hover .tape-inner { animation-play-state: paused; }
.tape-item { margin: 0 26px; }
.tape-item .up { color: #6fd39a; }
.tape-item .dim { color: #8e97b8; }
@keyframes tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .tape-inner { animation: none; }
  .tape { overflow-x: auto; }
}

/* ---------- hero ---------- */

.hero-grid {
  display: grid; grid-template-columns: 1.05fr 1fr;
  gap: 44px; align-items: center;
  padding: 34px 0 10px;
}
@media (max-width: 880px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-grid .actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }

/* terminal excerpt card — real rows from the archive */
.excerpt {
  background: var(--sheet);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--blue-wash);
  overflow: hidden;
}
.excerpt-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em;
  padding: 7px 14px; text-transform: uppercase;
}
.excerpt-bar .live { color: var(--hl); }
.excerpt table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.78rem; }
.excerpt th {
  text-align: right; padding: 8px 10px; color: var(--ink-soft);
  font-weight: 500; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--rule);
}
.excerpt th:first-child, .excerpt td:first-child { text-align: left; }
.excerpt td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--blue-wash); white-space: nowrap; }
.excerpt tr.gap td { color: var(--ink-soft); border-bottom-style: dashed; text-align: center; }
.excerpt tr.mark td { background: var(--hl); font-weight: 600; border-bottom: none; }
.excerpt .cap {
  font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft);
  padding: 8px 14px;
}

/* staggered row reveal on load — the page's one orchestrated moment */
.excerpt tbody tr { opacity: 0; animation: row-in 0.35s ease-out forwards; }
.excerpt tbody tr:nth-child(1) { animation-delay: 0.15s; }
.excerpt tbody tr:nth-child(2) { animation-delay: 0.3s; }
.excerpt tbody tr:nth-child(3) { animation-delay: 0.45s; }
.excerpt tbody tr:nth-child(4) { animation-delay: 0.6s; }
.excerpt tbody tr:nth-child(5) { animation-delay: 0.75s; }
.excerpt tbody tr:nth-child(6) { animation-delay: 0.95s; }
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .excerpt tbody tr { animation: none; opacity: 1; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  background: var(--sheet);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { text-decoration: none; box-shadow: 3px 3px 0 var(--rule); transform: translate(-1px, -1px); }
.btn:active { transform: none; box-shadow: none; }
.btn.primary { background: var(--blue); border-color: var(--blue-deep); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); box-shadow: 3px 3px 0 var(--hl); }
.btn.danger { border-color: var(--down); color: var(--down); background: var(--sheet); }
.btn.sm { padding: 6px 14px; font-size: 0.74rem; }
button.btn { font-family: var(--mono); }

/* ---------- cards & grid ---------- */

.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.price { font-family: var(--mono); font-weight: 600; font-size: 1.1rem; white-space: nowrap; }
.price::before { content: ""; }
.card .price, .total-row span:last-child { background: var(--hl); padding: 1px 7px; }

/* ---------- home: ready-to-buy bundle cards ---------- */

.bundle-grid { align-items: stretch; }
.bundle-card { position: relative; display: flex; flex-direction: column; border: 1.5px solid var(--rule); }
.bundle-card.popular { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--blue-wash); }
.badge-popular {
  position: absolute; top: -11px; left: 18px;
  background: var(--hl); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 3px;
  font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 10px;
}
.bundle-price { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.anchor-price {
  font-family: var(--mono); font-size: 0.85rem; font-weight: 500;
  color: var(--ink-soft); text-decoration: line-through; white-space: nowrap;
}
.spec-lines { list-style: none; margin: 0 0 16px; border-top: 1px solid var(--rule); }
.spec-lines li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 7px 0; border-bottom: 1px solid var(--blue-wash);
  font-size: 0.85rem;
}
.spec-lines li > span:first-child {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft);
  white-space: nowrap;
}
.spec-lines li > span:last-child { text-align: right; }
.bundle-cta { margin-top: auto; padding-top: 4px; }
.bundle-more { margin-top: 14px; }
.bundle-more .cat-count { font-size: 1.05rem; }
.bundle-more .cat-count .anchor-price { font-size: 0.78rem; margin-right: 4px; }

/* ---------- forms ---------- */

label { display: block; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 16px 0 6px; }

input[type="text"], input[type="email"], input[type="tel"], input[type="number"],
input[type="date"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--rule);
  background: var(--sheet);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: var(--sans);
}
input[type="date"], input[type="number"] { font-family: var(--mono); font-size: 0.88rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }

.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label {
  display: flex; align-items: center; gap: 8px; margin: 0;
  border: 1.5px solid var(--rule); padding: 9px 15px; border-radius: var(--radius);
  cursor: pointer; color: var(--ink); background: var(--sheet);
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.checks label:hover { border-color: var(--ink-soft); }
.checks label:has(input:checked) { background: var(--hl); border-color: var(--ink); font-weight: 600; }
.checks input { accent-color: var(--ink); }

/* Date-range presets: chips that fill the two date inputs in one click.
   Same visual language as .checks labels — the picked one takes NEAT yellow. */
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.preset {
  border: 1.5px solid var(--rule); border-radius: var(--radius);
  padding: 8px 13px; background: var(--sheet); color: var(--ink); cursor: pointer;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; line-height: 1.2; white-space: nowrap;
}
.preset:hover { border-color: var(--ink-soft); }
.preset.on { background: var(--hl); border-color: var(--ink); font-weight: 600; }
.preset.off {
  color: var(--ink-soft); background: var(--paper); border-style: dashed;
  opacity: 0.5; pointer-events: none; cursor: default;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- tables: the data sheet ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--sheet);
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
th {
  font-family: var(--mono); color: var(--ink-soft); font-weight: 500;
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--paper);
}
tbody tr:hover td { background: var(--blue-wash); }
td .mono, table .mono { font-size: 0.82rem; }

/* ---------- badges & alerts ---------- */

.badge {
  display: inline-block; padding: 3px 10px;
  font-family: var(--mono); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 3px; border: 1px solid;
}
.badge.pending { background: #fff7dc; color: #8a6d00; border-color: #e6c84a; }
.badge.approved { background: #e7f5ee; color: var(--up); border-color: #9fd4ba; }
.badge.rejected { background: #fdeceb; color: var(--down); border-color: #eaa79f; }
.badge.awaiting_payment { background: var(--blue-wash); color: var(--blue); border-color: #b9c4ec; }

.alert {
  border: 1.5px solid #e6c84a; background: #fff7dc; color: #6d5600;
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.9rem;
}
.alert.ok { border-color: #9fd4ba; background: #e7f5ee; color: var(--up); }
.alert.error { border-color: #eaa79f; background: #fdeceb; color: var(--down); }

/* ---------- how it works ---------- */

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.steps .step { padding: 20px; border-left: 1px solid var(--rule); font-size: 0.92rem; }
.steps .step:first-child { border-left: none; }
@media (max-width: 880px) { .steps { grid-template-columns: 1fr; } .steps .step { border-left: none; border-top: 1px solid var(--rule); } .steps .step:first-child { border-top: none; } }
.steps .num {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.1em; color: var(--blue); margin-bottom: 8px;
}

/* ---------- universe category grid ---------- */

.cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.cat-card {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--sheet);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.cat-card:hover { text-decoration: none; border-color: var(--ink); box-shadow: 3px 3px 0 var(--rule); transform: translate(-1px, -1px); }
.cat-card.on { border-color: var(--ink); background: var(--hl); }
.cat-card .cat-label {
  font-family: var(--mono); font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue);
}
.cat-card.on .cat-label { color: var(--ink); }
.cat-card .cat-count { font-family: var(--mono); font-size: 1.35rem; font-weight: 600; }
.cat-card .cat-desc { font-size: 0.76rem; color: var(--ink-soft); }
.cat-card.on .cat-desc { color: var(--ink); }

/* ---------- builder: stock search & tags ---------- */

.search-pop {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--blue-wash);
  max-height: 320px; overflow-y: auto;
}
.search-item {
  display: flex; gap: 10px; align-items: baseline; width: 100%;
  padding: 9px 14px; border: none; border-bottom: 1px solid var(--rule);
  background: none; text-align: left; cursor: pointer; font-family: var(--sans); font-size: 0.88rem;
  color: var(--ink);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--blue-wash); }
.search-item strong { font-family: var(--mono); }
.search-item span { color: var(--ink-soft); font-size: 0.8rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item em { font-family: var(--mono); font-style: normal; font-size: 0.7rem; color: var(--blue); }
.tag-x {
  border: none; background: none; cursor: pointer; font-size: 1rem; line-height: 1;
  color: var(--ink-soft); padding: 0 0 0 2px; font-family: var(--mono);
}
.tag-x:hover { color: var(--down); }
.dot-archive {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--up); vertical-align: 1px;
}

/* ---------- order page ---------- */

.qr-box { text-align: center; padding: 18px; background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); display: inline-block; }
.order-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

.total-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 1.05rem; font-weight: 700; padding-top: 14px;
  font-family: var(--mono);
}

#quoteBox { margin-top: 20px; }

hr { border: none; border-top: 1px solid var(--rule); margin: 18px 0; }

/* ---------- date range: the calendar block ---------- */
/* Pricing is per trading day, so the picker's job is not just to collect two
   dates — it has to make the day count (the thing being billed) visible before
   the buyer asks for a quote. */

.daterange {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
}
.daterange-field { display: flex; flex-direction: column; }
.daterange-field label {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px;
}
.daterange-field input[type="date"] {
  font-family: var(--mono); font-size: 0.9rem;
  padding: 11px 12px; width: 100%;
  border: 1.5px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink);
}
.daterange-field input[type="date"]:hover { border-color: var(--ink-soft); }
.daterange-field input[type="date"]:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-wash); }
.daterange-arrow { color: var(--ink-soft); font-family: var(--mono); padding-bottom: 12px; }

@media (max-width: 600px) {
  .daterange { grid-template-columns: 1fr; gap: 10px; }
  .daterange-arrow { display: none; }
}

.daterange-readout {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 13px;
  background: var(--blue-wash); border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.daterange-span { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.daterange-days {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--blue-deep);
}

/* ---------- "need something else" strip under the builder ---------- */
.ask-strip {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-top: 14px; padding: 14px 16px;
  background: var(--sheet); border: 1.5px solid var(--rule); border-radius: var(--radius);
}
.ask-strip strong { display: block; font-size: 0.95rem; }
.ask-strip .muted { display: block; margin-top: 2px; }
.btn.ghost { background: transparent; border-color: var(--ink); }

.req { color: var(--down); }

/* ---------- bundle grid: one consistent card for every pack ---------- */
/* Previously the first three rendered as rich cards and the rest as cramped
   link tiles with a run-on description and no buy button. Same product, same
   card. `align-items: stretch` plus the flex column below keeps every CTA on
   the same baseline no matter how uneven the copy is. */

.bundle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
  align-items: stretch;
}
.bundle-card { height: 100%; }

.bundle-name {
  display: block;
  font-size: 0.95rem;
  line-height: 1.35;
  min-height: 2.7em;          /* two lines, so prices align across the row */
  margin-bottom: 2px;
}

.bundle-price { flex-wrap: wrap; }
.bundle-price .price { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }

.save-pill {
  font-family: var(--mono); font-size: 0.63rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--up); color: #fff;
  padding: 2px 7px; border-radius: 3px;
  white-space: nowrap;
}

/* Long instrument lists get truncated rather than allowed to reflow the grid. */
.spec-lines li > span:last-child {
  overflow-wrap: anywhere;
  max-width: 62%;
}

@media (max-width: 640px) {
  .bundle-grid { grid-template-columns: 1fr; }
  .bundle-name { min-height: 0; }
}

/* Price is derived straight from the day count, so the card states that instead
   of striking through a second number. */
.per-day {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-soft); white-space: nowrap;
}
