:root {
  color-scheme: light;
  --ink: #111417;
  --muted: #58636d;
  --soft: #eef2f4;
  --paper: #f5f7f8;
  --panel: #ffffff;
  --line: #dbe1e3;
  --line-strong: #bac6cb;
  --brand: #1e5a78;
  --brand-dark: #12394d;
  --green: #24614d;
  --green-soft: #e8f3ee;
  --gold: #9a620f;
  --gold-soft: #fff1d9;
  --blue: #2a5f8f;
  --blue-soft: #e7f0f7;
  --danger: #9c2430;
  --danger-soft: #f8e6e8;
  --shadow: 0 18px 50px rgba(17, 20, 23, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--brand-dark);
}

.stock-screener-shell {
  min-height: 100vh;
}

.site-bar {
  display: flex;
  width: min(1120px, calc(100vw - 32px));
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto;
  padding: 22px 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 16px rgba(18, 57, 77, 0.1));
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-wordmark span:first-child {
  color: var(--brand-dark);
}

.brand-domain {
  color: var(--green);
}

.site-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.site-meta span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  padding: 4px 10px;
}

.lookup-page {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 54px;
}

.search-panel {
  display: grid;
  place-items: center;
  min-height: min(610px, calc(100vh - 120px));
  padding: 46px 0 28px;
  text-align: center;
}

.has-query .search-panel {
  min-height: auto;
  padding: 22px 0 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-panel h1 {
  max-width: 790px;
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.has-query .search-panel h1 {
  font-size: clamp(1.8rem, 5vw, 3.6rem);
}

.intro-copy {
  max-width: 660px;
  margin: 18px 0 0;
  color: #46525b;
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.55;
}

.has-query .intro-copy {
  margin-top: 12px;
}

.lookup-search-wrap {
  position: relative;
  width: min(720px, 100%);
  margin-top: 32px;
}

.has-query .lookup-search-wrap {
  margin-top: 18px;
}

.lookup-input {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  font-size: clamp(1.05rem, 2vw, 1.26rem);
}

.lookup-input::placeholder {
  color: #778188;
}

.lookup-input:focus,
.example-button:focus,
.recent-button:focus,
.suggestion-button:focus,
.secondary-button:focus,
.text-button:focus,
.control-input:focus,
.stock-details summary:focus {
  outline: 3px solid rgba(30, 90, 120, 0.22);
  outline-offset: 2px;
}

.suggestion-list {
  position: absolute;
  z-index: 5;
  display: grid;
  width: 100%;
  max-height: 330px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: left;
}

.suggestion-list[hidden] {
  display: none;
}

.suggestion-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 11px 14px;
  text-align: left;
}

.suggestion-button:last-child {
  border-bottom: 0;
}

.suggestion-button:hover {
  background: #f5f8f9;
}

.suggestion-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-button strong {
  display: inline-block;
  min-width: 54px;
  margin-right: 8px;
  color: var(--brand);
}

.suggestion-button small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.suggestion-empty {
  padding: 13px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.example-row,
.recent-list,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.example-row {
  margin-top: 14px;
}

.example-button,
.recent-button,
.secondary-button,
.text-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #2d363b;
  padding: 6px 12px;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.example-button:hover,
.recent-button:hover,
.secondary-button:hover,
.text-button:hover {
  background: #f3f7f8;
}

.primary-disclaimer {
  max-width: 760px;
  margin: 24px 0 0;
  color: #53606a;
  font-size: 0.92rem;
  line-height: 1.55;
}

.privacy-disclosure {
  width: min(720px, 100%);
  margin-top: 18px;
  text-align: left;
}

.privacy-disclosure summary {
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
}

.privacy-body {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px;
}

.privacy-body p,
.recent-empty,
.consent-status,
.data-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #2c3439;
  font-weight: 700;
}

.recent-searches {
  display: grid;
  gap: 8px;
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.recent-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.recent-button {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
}

.recent-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-button strong {
  color: var(--brand);
}

.text-button {
  min-height: 30px;
  padding: 4px 10px;
}

.result-region {
  margin-top: -24px;
}

.has-query .result-region {
  margin-top: 6px;
}

.empty-result,
.result-card,
.load-error {
  width: min(900px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 32px);
}

.empty-result {
  text-align: center;
}

.empty-result h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.empty-result p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--muted);
}

.result-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.result-topline h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.04;
}

.result-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.account-pill {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 900;
  white-space: nowrap;
}

.best-tfsa {
  background: var(--green-soft);
  color: var(--green);
}

.best-rrsp {
  background: var(--blue-soft);
  color: var(--blue);
}

.best-non-registered {
  background: var(--gold-soft);
  color: var(--gold);
}

.decision-grid,
.metrics-grid,
.details-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.decision-tile,
.metric,
.account-note {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 13px;
}

.decision-tile span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-tile strong,
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(1rem, 2vw, 1.32rem);
}

.plain-summary {
  margin-top: 22px;
  border-left: 4px solid var(--brand);
  padding-left: 15px;
}

.plain-summary h3 {
  margin: 0;
  font-size: 1rem;
}

.plain-summary p {
  margin: 7px 0 0;
  color: #343d43;
  line-height: 1.6;
}

.stock-details {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.stock-details summary {
  cursor: pointer;
  color: var(--brand-dark);
  font-weight: 900;
}

.account-note h3 {
  margin: 0;
  font-size: 1rem;
}

.account-note p {
  margin: 8px 0 0;
  color: #435059;
  font-size: 0.93rem;
  line-height: 1.55;
}

.account-note.tfsa {
  border-color: rgba(36, 97, 77, 0.32);
}

.account-note.rrsp {
  border-color: rgba(42, 95, 143, 0.32);
}

.account-note.taxable {
  border-color: rgba(154, 98, 15, 0.32);
}

.detail-note,
.position-row {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: #435059;
  line-height: 1.5;
}

.position-row {
  width: min(360px, 100%);
  font-weight: 800;
}

.control-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
}

.position-output {
  margin: 8px 0 0;
  color: #2f383d;
  font-weight: 800;
}

.result-actions {
  justify-content: flex-start;
  margin-top: 20px;
}

.seo-education {
  width: min(940px, 100%);
  margin: 54px auto 0;
  border-top: 1px solid var(--line);
  padding: 42px 0 8px;
  text-align: left;
}

.seo-education h2 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.education-lede {
  max-width: 760px;
  margin: 16px 0 0;
  color: #435059;
  font-size: 1.04rem;
  line-height: 1.62;
}

.education-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.education-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 18px;
}

.education-grid h3 {
  margin: 0;
  font-size: 1.03rem;
}

.education-grid p,
.source-note {
  color: #48545d;
  line-height: 1.58;
}

.education-grid p {
  margin: 9px 0 0;
  font-size: 0.95rem;
}

.education-actions {
  margin-top: 22px;
}

.source-note {
  max-width: 860px;
  margin: 16px 0 0;
  font-size: 0.9rem;
}

.education-faq {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.education-faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 14px;
}

.education-faq summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 900;
}

.education-faq p {
  max-width: 760px;
  margin: 10px 0 0;
  color: #48545d;
  line-height: 1.58;
}

.app-footer {
  display: flex;
  width: min(1120px, calc(100vw - 32px));
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 20px 0 34px;
  color: var(--muted);
  font-size: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.static-fallback,
.privacy-page,
.article-page {
  width: min(880px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.static-fallback h1,
.privacy-page h1,
.article-page h1 {
  margin: 16px 0 12px;
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.static-fallback p,
.privacy-page p,
.article-page p,
.article-page li {
  color: #4a5156;
  line-height: 1.58;
}

.privacy-page h2,
.article-page h2 {
  margin: 26px 0 8px;
  font-size: 1.1rem;
}

.article-page h2 {
  margin-top: 34px;
  font-size: 1.35rem;
}

.article-page h3 {
  margin: 20px 0 6px;
  font-size: 1.05rem;
}

.article-page ul,
.article-page ol {
  padding-left: 22px;
}

.article-meta {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.article-disclaimer,
.article-callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
}

.article-disclaimer {
  border-color: rgba(156, 36, 48, 0.22);
  background: var(--danger-soft);
}

.article-callout {
  margin: 24px 0;
}

.source-list {
  display: grid;
  gap: 8px;
}

.back-link {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  padding: 4px 12px 4px 6px;
  color: var(--brand-dark);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
}

.brand-back-link {
  border-radius: 999px;
}

.back-logo {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .site-bar {
    align-items: flex-start;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .brand-wordmark {
    font-size: 0.98rem;
  }

  .site-meta {
    display: none;
  }

  .lookup-page {
    padding-top: 4px;
  }

  .search-panel {
    min-height: auto;
    padding: 30px 0 18px;
  }

  .search-panel h1 {
    font-size: clamp(2rem, 12vw, 3.6rem);
  }

  .intro-copy {
    font-size: 1rem;
  }

  .lookup-input {
    min-height: 58px;
    font-size: 1rem;
  }

  .suggestion-button {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .suggestion-button span {
    width: 100%;
  }

  .result-region {
    margin-top: 0;
  }

  .result-topline,
  .decision-grid,
  .metrics-grid,
  .details-grid,
  .education-grid {
    grid-template-columns: 1fr;
  }

  .account-pill {
    justify-self: start;
  }
}
