/* Approved Analyze entry screen. Result views keep the existing design system. */
.landing-input { display: contents; }
.landing-link-icon { display: none; }


body.is-landing {
  --bg: #181c1a;
  --card: #202522;
  --border: #343c37;
  --text: #e5e9e2;
  --text-bright: #e5e9e2;
  --muted: #a3aca4;
  --tag-bg: #292f2b;
  --landing-fill: #b7482d;
  --landing-focus: #f0997b;
  padding: 0 42px 30px;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
body.is-landing.light {
  --bg: #f4f3ee;
  --card: #fbfaf6;
  --border: #dcded6;
  --text: #202923;
  --text-bright: #202923;
  --muted: #626c66;
  --tag-bg: #eceee8;
  --landing-focus: #9c3d28;
}
body.is-landing .app { max-width: 1120px; }
body.is-landing .app-header {
  min-height: 76px;
  margin-bottom: 0;
  gap: 36px;
  border-bottom: 1px solid var(--border);
}
body.is-landing .app-logo { width: 29px; height: 29px; border-radius: 7px; }
body.is-landing .app-title { letter-spacing: -.045em; }
body.is-landing .primary-nav { gap: 5px; }
body.is-landing .primary-nav a { min-height: 40px; }
body.is-landing .header-utils { gap: 6px; }
body.is-landing #tab-analyze { width: min(760px, 100%); margin: 0 auto; padding: 48px 0 16px; }
body.is-landing .home-intro { display: block; margin: 12px 0 8px; }
body.is-landing .home-title {
  max-width: 670px;
  font: 400 clamp(33px, 4vw, 42px)/1.08 'Newsreader', Georgia, serif;
  letter-spacing: -.045em;
}
body.is-landing .search-row { gap: 9px; margin: 20px 0 0; }
body.is-landing .landing-input {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 56px;
  padding: 0 17px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(32,41,35,.025);
  transition: border-color .18s, box-shadow .18s;
}
body.is-landing .landing-input:focus-within {
  border-color: var(--landing-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--landing-focus) 13%, transparent);
}
body.is-landing .landing-input:has(.input-valid) { border-color: var(--green-ink); }
body.is-landing .landing-input:has(.input-invalid) { border-color: var(--red-ink); }
body.is-landing .landing-link-icon { display: block; width: 16px; height: 16px; flex: none; margin-right: 11px; color: var(--muted); }
body.is-landing #urlInput {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  font: 400 15px 'DM Sans', sans-serif;
  color: var(--text);
}
body.is-landing .search-row button {
  min-height: 56px;
  padding: 0 24px;
  border: 1px solid var(--landing-fill);
  border-radius: 9px;
  background: var(--landing-fill);
  font: 600 13px 'DM Sans', sans-serif;
  color: #fffaf5;
}
body.is-landing .search-row button:hover { filter: brightness(.94); }
body.is-landing .landing-lower-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 36px;
}
body.is-landing .start-examples { margin: 0; gap: 8px; }
body.is-landing .start-examples-label { color: var(--muted); font-size: 12px; }
body.is-landing .start-example {
  min-height: 31px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: 400 12px 'DM Sans', sans-serif;
}
.landing-coverage { position: relative; flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.landing-coverage summary { cursor: pointer; padding: 8px 0; }
.landing-coverage p {
  position: absolute;
  z-index: 4;
  top: calc(100% + 7px);
  right: 0;
  width: min(330px, 78vw);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
  line-height: 1.6;
}
body.is-landing .market-toolbar,
body.is-landing #startCard { display: none; }
body.is-landing.landing-tools-open .market-toolbar { display: flex; margin-top: 24px; }
/* Preserve H/B keyboard shortcuts: an opened existing panel must be visible. */
body.is-landing .market-toolbar:has(#historyPanel[style*="block"]),
body.is-landing .market-toolbar:has(#bookmarksPanel[style*="block"]) { display: flex; margin-top: 24px; }
body.is-landing #compareSection { grid-template-columns: minmax(0, 1fr); }
body.is-landing .compare-url-input { min-width: 0; width: 100%; }
body.is-landing .footer { margin-top: 36px; padding-top: 16px; font-size: 11px; }
body.is-landing :is(button, summary, a):focus-visible { outline: 2px solid var(--landing-focus); outline-offset: 3px; }

@media (max-width: 760px) {
  body.is-landing { padding: 0 22px 24px; }
  body.is-landing .app-header { min-height: 68px; gap: 18px; flex-wrap: wrap; padding: 13px 0; }
  body.is-landing .primary-nav { order: 3; flex: 1 0 100%; margin: 0 -8px; }
  body.is-landing .primary-nav a { min-height: 44px; }
  body.is-landing .header-utils { order: 0; }
  body.is-landing .header-explore { margin-left: auto; }
  body.is-landing #tab-analyze { padding-top: 38px; }
  body.is-landing .landing-lower-row { align-items: flex-start; }
  body.is-landing .start-examples { max-width: 62%; }
  body.is-landing .landing-coverage { max-width: 38%; text-align: right; }
  body.is-landing .footer { margin-top: 32px; }
  /* Anchor either panel to the row, not to the offset Saved button. */
  body.is-landing .market-toolbar { position: relative; }
  body.is-landing .toolbar-menu { position: static; }
  body.is-landing :is(.history-panel, .bookmarks-panel) {
    left: 0;
    width: min(340px, 100%);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}
@media (max-width: 480px) {
  body.is-landing { padding: 0 16px 22px; }
  body.is-landing .app-header { gap: 10px; }
  body.is-landing .header-utils { gap: 0; margin-left: 0; }
  body.is-landing #tab-analyze { padding-top: 30px; }
  body.is-landing .home-title { margin-top: 7px; font-size: 35px; }
  body.is-landing .search-row { flex-direction: row; gap: 7px; margin-top: 17px; }
  body.is-landing .landing-input { min-height: 52px; padding: 0 11px; }
  body.is-landing .landing-link-icon { margin-right: 7px; }
  body.is-landing #urlInput { font-size: 15px; }
  body.is-landing .search-row button { width: auto; min-height: 52px; padding: 0 15px; }
  body.is-landing .landing-lower-row { gap: 10px; }
  body.is-landing .start-examples { max-width: 68%; gap: 6px; }
  body.is-landing .start-examples-label { flex-basis: 100%; }
  body.is-landing .landing-coverage { max-width: 32%; font-size: 11px; }
  body.is-landing .landing-coverage p { width: min(280px, 86vw); }
  body.is-landing .footer { margin-top: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  body.is-landing *, body.is-landing *::before, body.is-landing *::after { transition: none; animation: none; }
}

/* Shared index shell tokens also cover Compare, loading and error states, where
   neither the landing nor single-result body class is present. The approved
   landing/result selectors above remain intentionally isolated. */
body {
  --bg: #181c1a;
  --card: #202522;
  --border: #343c37;
  --border-hi: #4a554d;
  --text: #d6ddd5;
  --text-mid: #d6ddd5;
  --text-bright: #e5e9e2;
  --muted: #a3aca4;
  --tag-bg: #292f2b;
  --bar-bg: #292f2b;
  --orange: #e47756;
  --result-accent: #e47756;
  --accent-ink: #e47756;
  --accent-fill: #b7482d;
  --landing-fill: #b7482d;
  --landing-focus: #f0997b;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}
body.light {
  --bg: #f4f3ee;
  --card: #fbfaf6;
  --border: #dcded6;
  --border-hi: #c8cec4;
  --text: #39463d;
  --text-mid: #39463d;
  --text-bright: #202923;
  --muted: #626c66;
  --tag-bg: #eceee8;
  --bar-bg: #eceee8;
  --orange: #9c3d28;
  --result-accent: #b7482d;
  --accent-ink: #9c3d28;
  --accent-fill: #b7482d;
  --landing-focus: #9c3d28;
}
body:not(.is-landing):not(.has-market-result) { padding: 0 36px 30px; }
body:not(.is-landing):not(.has-market-result) .app { max-width: 1120px; }
body:not(.is-landing):not(.has-market-result) .app-header {
  min-height: 69px;
  margin-bottom: 0;
  gap: 26px;
  border-bottom: 1px solid var(--border);
}
body:not(.is-landing):not(.has-market-result) :is(#tab-discover, #tab-watchlist, #tab-tools, #tab-rewards) {
  max-width: 1010px;
  min-width: 0;
  margin: 0 auto;
  padding-top: 28px;
}
body:not(.is-landing):not(.has-market-result) :is(#discoverContent, #watchlistContent, #recentContent, #calendarContent, #toolsContent, #rewardsContent) {
  min-width: 0;
}
body:not(.is-landing):not(.has-market-result) :is(.empty-state, .discovery-status-card) {
  border-color: var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
}
body:not(.is-landing):not(.has-market-result) :is(.discover-market, .wl-card, .cal-day, .cal-market, .rewards-platform-card) {
  min-width: 0;
  overflow-wrap: anywhere;
}
body:not(.is-landing):not(.has-market-result) .discover-market {
  min-height: 76px;
  padding: 16px 18px;
  border-color: var(--border);
  border-radius: 9px;
  background: var(--card);
}
body:not(.is-landing):not(.has-market-result) :is(.discover-market-title, .wl-card-title, .compare-col-title, .rewards-program-name) {
  overflow-wrap: anywhere;
}
body:not(.is-landing):not(.has-market-result) .wl-card-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.4;
}
body:not(.is-landing):not(.has-market-result) .cal-market { min-height: 40px; }
body:not(.is-landing):not(.has-market-result) .compare-section { min-width: 0; }
body:not(.is-landing):not(.has-market-result) .saved-switch {
  position: sticky;
  top: 8px;
  z-index: 5;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
body:not(.is-landing):not(.has-market-result) .saved-switch-btn { min-height: 40px; padding-inline: 13px; }
body:not(.is-landing):not(.has-market-result) :is(.watchlist-grid, .calendar-grid, .rewards-program-grid) { min-width: 0; }
body:not(.is-landing):not(.has-market-result) :is(.wl-card, .cal-day, .rewards-platform-card) {
  border-color: var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow-wrap: anywhere;
}
body:not(.is-landing):not(.has-market-result) .rewards-live-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
body:not(.is-landing):not(.has-market-result) .rewards-live-table { min-width: 640px; }
body:not(.is-landing):not(.has-market-result) :is(.compare-url-input, .gem-search-input, .gem-select, .alert-form input, .pnl-input-grid input) {
  min-width: 0;
  max-width: 100%;
}
body:not(.is-landing):not(.has-market-result) :is(.compare-submit-btn, .saved-switch-btn, .rewards-expand-btn, .rewards-program-link) {
  min-height: 42px;
}
body:not(.is-landing):not(.has-market-result) :is(button, input, select, textarea, a, summary):focus-visible {
  outline: 2px solid var(--landing-focus);
  outline-offset: 3px;
}

@media (min-width: 641px) and (max-width: 900px) {
  body:not(.is-landing):not(.has-market-result) { padding: 30px 24px 64px; }
  body:not(.is-landing):not(.has-market-result) :is(#tab-discover, #tab-watchlist, #tab-tools, #tab-rewards) { padding-top: 24px; }
  body:not(.is-landing):not(.has-market-result) .watchlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:not(.is-landing):not(.has-market-result) .calendar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body:not(.is-landing):not(.has-market-result) :is(.watchlist-grid, .calendar-grid, .rewards-program-grid) {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  body:not(.is-landing):not(.has-market-result) { padding: 0 14px 24px; }
  body:not(.is-landing):not(.has-market-result) :is(#tab-discover, #tab-watchlist, #tab-tools, #tab-rewards) {
    padding-top: 20px;
  }
  body:not(.is-landing):not(.has-market-result) .saved-switch {
    position: relative;
    top: auto;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  body:not(.is-landing):not(.has-market-result) .saved-switch-btn { flex: 0 0 auto; }
  body:not(.is-landing):not(.has-market-result) .discover-market { padding: 14px; }
}
