/* Engine pages, on top of base.css. Colors come from base.css, which uses the landing page's
   tokens since the UX pass of 2026-10-25. The app redesign of 2026-10-25 adds the one action
   card for sign in pages, stock cards, plan cards and the upgrade moments.

   Color pairs with palette v2 (WCAG 2.x relative luminance, light then dark; text needs 4.5:1,
   UI 3:1):
   --ink on --bg / --surface:                           14.19 / 15.23   15.63 / 14.09
   --muted on --bg / --surface:                          5.77 / 6.19     7.76 / 6.99
   --accent on --bg / --surface (links):                 4.97 / 5.33     8.07 / 7.27
   --accent-ink on --accent (buttons):                   5.33            8.07
   --accent on --accent-soft (Just added, On, auth icon): 4.68           6.11
   --ink on --accent-soft (upgrade moment text):        13.37           11.84
   --muted on --accent-soft (moment fine print):         5.44            5.88
   --ink / --muted on --note-bg (notices, Off):         13.42 / 5.46    12.70 / 6.31
   --danger on --bg (Delete my account):                 5.24            6.32
   --danger on --surface (Paused):                       5.62            5.70
   --danger on --note-bg (Remove on hover):              4.95            5.14
   Danger button label on --danger:                      5.62            6.47
   --focus ring (the accent) on --surface / --bg / --accent-soft: 5.33 / 4.97 / 4.68   7.27 / 8.07 / 6.11
   --field outline (inputs, chips, outline button) on --surface / --bg: 3.59 / 3.35   3.61 / 4.00
   --accent on --note-bg is 4.70 / 6.56, but paused cards still keep --surface and get a dashed
   border. The meter's empty segments (--line) are decorative and hidden from assistive tech;
   the "2 of 10 stocks" text carries the count. Form badges are neutral ink outlines on
   --surface, so the accent stays for actions. */

a { color: var(--accent); text-underline-offset: 3px; }
a.brand { color: var(--ink); text-decoration: none; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link, as on the landing page (site.css). */
.skip {
  position: absolute; left: 12px; top: 8px; z-index: 100;
  background: var(--surface); color: var(--ink); padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line); transform: translateY(-200%);
}
.skip:focus { transform: none; }

.page { padding: 32px 16px 24px; }
.page:focus { outline: none; }
.page h1 { font-size: clamp(28px, 6vw, 36px); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.03em; }
.page > p { margin: 0 0 14px; }

form.stack { display: grid; gap: 8px; max-width: 460px; margin: 0 0 14px; }
form.stack label { font-size: 15px; font-weight: 500; color: var(--ink); }
form.stack input {
  font: inherit; padding: 11px 14px; min-height: 48px; border-radius: 10px;
  border: 1px solid var(--field); background: var(--surface); color: var(--ink); width: 100%;
}
form.stack input::placeholder { color: var(--muted); opacity: 1; }
form.stack input:focus-visible { outline-offset: 1px; border-color: var(--focus); }
form.stack input[aria-invalid="true"] { border-color: var(--danger); }

button.secondary {
  font: inherit; font-size: 15px; font-weight: 500; background: transparent; color: var(--ink);
  border: 1px solid var(--field); border-radius: 999px; min-height: 44px; padding: 8px 18px; cursor: pointer;
}
button.secondary:hover { border-color: var(--ink); }
button.cta.danger { background: var(--danger); color: #ffffff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.cta.danger { color: #1a0b0b; }
}
button:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { button:active { transform: none; } }

.notice { border-radius: 12px; padding: 12px 16px; margin: 0 0 14px; background: var(--note-bg); }
.notice p { margin: 0 0 10px; }
.notice.error { border-left: 4px solid var(--danger); }
.notice.ok { border-left: 4px solid var(--accent); }
ul.choices { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
ul.choices form { margin: 0; }

/* Plans while billing is off (the coming soon list), unchanged in shape. */
ul.watch { list-style: none; padding: 0; margin: 0 0 16px; }
ul.watch li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 8px;
}
ul.watch .company { color: var(--muted); }

/* ---------- One action pages: sign in, check email, confirm, expired ---------- */
body.v-auth .page { padding-top: 40px; }
.auth-card {
  max-width: 460px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); padding: 32px 28px 24px;
}
.auth-card h1 { font-size: clamp(28px, 6vw, 32px); }
.auth-card .lede { margin: 0 0 20px; }
.auth-card form.stack { max-width: none; gap: 8px; }
.auth-card form button.cta { width: 100%; margin-top: 8px; }
.auth-card form button.secondary { width: 100%; }
.auth-card a.cta { width: 100%; }
.auth-card .fine { margin: 14px 0 0; }
.auth-more { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 18px; }
.auth-more p { margin: 0 0 12px; color: var(--muted); font-size: 15px; }
.auth-more form { margin: 0; }
.auth-icon {
  display: block; width: 52px; height: 52px; padding: 12px; margin: 0 0 18px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
}
.page > p.auth-aside { max-width: 460px; margin: 18px auto 0; text-align: center; }
.picked { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.pick {
  display: inline-block; padding: 2px 10px; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; margin-right: 4px;
}
body.v-auth footer, body.v-auth footer .wrap { text-align: center; }

/* ---------- Watchlist ---------- */
body.v-app { --max: 780px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 4px 16px; margin: 0 0 20px; }
.page-head h1 { margin: 0; }
.usage { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.usage .fine { margin: 0; }
.meter { display: inline-flex; gap: 4px; }
.meter span { width: 22px; height: 6px; border-radius: 999px; background: var(--line); }
.meter span.on { background: var(--accent); }

body.v-app section { border-top: 0; }
body.v-app section[aria-labelledby] {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 22px 18px; margin: 0 0 16px;
}
body.v-app section.stocks { background: none; border: 0; padding: 0; }
body.v-app section h2 { font-size: 21px; }
body.v-app section form { margin: 0 0 8px; }

/* First run: the add field is the one thing on the page. */
section.first-run { box-shadow: var(--shadow); }
body.v-app section.first-run { padding: 28px 24px 22px; }
section.first-run h2 { font-size: clamp(24px, 5vw, 28px); }
section.first-run > p { color: var(--muted); max-width: 60ch; }

.add-form { max-width: 560px; }
.add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.add-row button.cta { min-height: 48px; padding: 10px 26px; }

.chips { margin: 14px 0 4px; }
.chips-label { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.chip-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
button.chip {
  font: inherit; font-size: 15px; display: inline-flex; align-items: baseline; gap: 6px;
  min-height: 44px; padding: 9px 14px; border-radius: 999px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--field);
}
button.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip-ticker { font-family: var(--mono); font-weight: 500; letter-spacing: 0.02em; }
.chip-name { color: var(--muted); }

/* Stock cards */
ul.stock-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
li.stock {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 8px 10px 18px;
}
li.stock.is-paused { border-style: dashed; }
.stock-name { margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.stock-name strong { font-family: var(--mono); font-weight: 500; font-size: 18px; letter-spacing: 0.02em; }
.stock-name .company { color: var(--muted); font-size: 15px; }
.paused { color: var(--danger); font-size: 13px; font-weight: 600; }
/* "Just added": a small muted badge, not a highlight. */
.new-tag {
  font-size: 12px; font-weight: 500; color: var(--muted); background: var(--note-bg);
  padding: 1px 8px; border-radius: 999px;
}
.last-filing { display: block; font-size: 14px; color: var(--muted); }
.stock-side { display: flex; align-items: center; gap: 6px; }
body.v-app .stock-side form { margin: 0 0 0 auto; }
.form-badge {
  display: inline-block; white-space: nowrap; font-size: 13px; font-weight: 600; line-height: 1.4;
  padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; background: var(--surface);
}
.form-badge.f4, .form-badge.f13, .form-badge.f8k { color: var(--ink); }
.form-badge.fx { color: var(--muted); }
button.quiet {
  font: inherit; font-size: 14px; color: var(--muted); background: transparent; border: 0;
  min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 999px; cursor: pointer;
}
button.quiet:hover { color: var(--danger); background: var(--note-bg); }

/* Upgrade moments: the list is full, or a filing waits for the morning email. */
.moment {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 16px;
  padding: 18px 20px; margin: 0 0 16px;
}
.moment p { margin: 0 0 10px; }
.moment .moment-title { font-weight: 600; }
.moment .fine { color: var(--muted); margin: 8px 0 0; }
.moment-form { margin: 12px 0 0; }
section .moment { margin: 0; }

.state { display: inline-block; font-size: 13px; font-weight: 600; padding: 1px 10px; border-radius: 999px; }
/* Daily email: one row, the label, On or Off, and the button. */
body.v-app section.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 14px 16px 14px 22px; }
body.v-app section.email-row h2 { font-size: 17px; margin: 0; flex: 1 1 auto; }
body.v-app section.email-row form { margin: 0; }
.state.on { color: var(--accent); background: var(--accent-soft); }
.state.off { color: var(--muted); background: var(--note-bg); }

.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.account-actions form { margin: 0; }
body.v-app section .account-actions form { margin: 0; }
a.danger-link { color: var(--danger); font-size: 15px; display: inline-flex; align-items: center; min-height: 44px; }

/* Plan cards: Plus is the default choice unless the landing page pick says otherwise. */
.upsell { color: var(--ink); }
ul.plans { list-style: none; padding: 0; margin: 4px 0 12px; display: grid; gap: 12px; }
ul.plans li {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface);
}
ul.plans li.featured, ul.plans li.chosen { border: 2px solid var(--accent); padding: 17px; box-shadow: var(--shadow); }
.plan-head p { margin: 0 0 4px; }
.plan-name strong { font-size: 18px; letter-spacing: -0.01em; }
.plan-price { font-size: 15px; color: var(--muted); }
.plan-price .amount { font-size: 30px; font-weight: 600; color: var(--ink); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.plan-head .company { color: var(--muted); font-size: 15px; }
ul.plans form { margin: 0; }
ul.plans button.cta, ul.plans button.secondary { width: 100%; }
ul.plans form .fine { margin: 8px 0 0; }
ul.plans li:not(.featured):not(.chosen) button.cta { background: transparent; color: var(--ink); border-color: var(--field); }
ul.plans li:not(.featured):not(.chosen) button.cta:hover { border-color: var(--ink); filter: none; }

/* Day zero: the plan section folds into one line until the first stock is on the list. */
body.v-app section.compact { padding: 4px 22px; }
.plans-more > summary {
  list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 2px 16px; min-height: 52px; padding: 10px 0; border-radius: 8px;
}
.plans-more > summary::-webkit-details-marker { display: none; }
.compact-line { color: var(--muted); font-size: 15px; }
.see-plans {
  color: var(--ink); font-weight: 600; font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 6px 16px; border: 1px solid var(--field); border-radius: 999px;
}
.plans-more > summary:hover .see-plans { border-color: var(--ink); }
.see-plans::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}
.plans-more[open] .see-plans::after { transform: translateY(2px) rotate(-135deg); }
.plans-more[open] > summary { border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.plans-more[open] { padding-bottom: 14px; }

/* Monthly or yearly: two radios drawn as one segmented control. Only the price, button and
   renewal disclosure of the checked interval show; the others are display:none, so a button is
   never shown without its own disclosure. Browsers without :has() show both pairs. */
fieldset.seg {
  display: inline-flex; margin: 0 0 14px; padding: 3px; border: 1px solid var(--field); border-radius: 999px;
  background: var(--surface); position: relative;
}
fieldset.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
fieldset.seg label {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px;
  font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer;
}
fieldset.seg input:checked + label { background: var(--ink); color: var(--surface); }
fieldset.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-pick:has(input[value="month"]:checked) .iv-year,
.plan-pick:has(input[value="year"]:checked) .iv-month { display: none; }

@media (min-width: 640px) {
  ul.plans { grid-template-columns: 1fr 1fr; }
  .page { padding-top: 40px; }
}

@media (max-width: 599px) {
  .page form button.cta { width: 100%; }
  .add-row button.cta, .moment-form button.cta { width: auto; }
  .moment-form button.cta { width: 100%; }
  /* Phones: name and filing get the full width; badge and Remove sit in a row underneath. */
  li.stock { grid-template-columns: minmax(0, 1fr); padding: 12px 8px 8px 14px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  /* The count above the meter, each on one line. */
  .usage { flex-direction: column-reverse; align-items: flex-start; gap: 6px; }
  fieldset.seg { display: flex; max-width: 100%; }
  fieldset.seg label { flex: 1 1 auto; justify-content: center; padding: 0 10px; font-size: 14px; white-space: nowrap; }
  .stock-side { justify-content: space-between; }
  body.v-app section[aria-labelledby] { padding: 18px 16px 14px; }
  .auth-card { padding: 26px 20px 20px; }
  body.v-auth .page { padding-top: 24px; }
  /* Keep the field and the chips above the fold on a first visit. */
  header.top { padding: 6px 0; }
  .page { padding-top: 18px; }
  .page-head { margin: 0 0 12px; }
  .page h1 { font-size: 28px; margin: 0 0 4px; }
  body.v-app section.first-run { padding: 18px 16px 14px; }
  section.first-run h2 { font-size: 22px; margin: 0 0 6px; }
  section.first-run > p { margin: 0 0 12px; font-size: 16px; }
  .chips { margin-top: 10px; }
  .chip-form { gap: 6px; }
  button.chip { padding: 8px 12px; font-size: 14px; }
  body.v-app section.compact { padding: 2px 16px; }
}
