/* ===========================================================
   Design tokens
   Palette grounded in the physical mandi "bhav board" — the
   painted rate board at market gates: deep board-green, marigold
   chalk-yellow for the ticker, warm paper background for the
   price list (high contrast, legible in direct outdoor sunlight).
   =========================================================== */
:root {
  /* REVERTED 2026-09: tried shifting this to olive (#4a5a23) to
     differentiate from a competitor's similar green, but it didn't land
     well visually — back to the original. Differentiation effort is
     now focused on the card layout/structure instead of the color,
     since that's the part that was actually still reading as similar. */
  --board-green: #1f4d2c;
  --board-green-light: #2f6b3d;
  --marigold: #e3a008;
  --paper: #faf6ec;
  --card: #ffffff;
  --ink: #1c2317;
  --muted-ink: #5b6b58;
  --rise: #2e7d32;
  --fall: #c0392b;
  --flat: #8a8a7a;
  --line: #e4ddca;

  --font-display: "Barlow Condensed", "Mukta", sans-serif;
  --font-body: "Mukta", system-ui, sans-serif;

  --radius: 14px;
}

/* Per-script font overrides — app.js sets data-script on <html> to match
   the active language (see LANG_META / applyI18n in i18n.js). Barlow
   Condensed + Mukta only cover Latin and Devanagari (English, Hindi,
   Marathi), loaded upfront in index.html since most visitors will need
   one of those three. Kannada, Malayalam, Tamil, and Telugu need their
   own Noto Sans variants entirely — i18n.js lazy-loads the matching
   stylesheet the first time a visitor actually picks one of those
   languages, and these rules point the font variables at it once it's
   available. Falls back to Mukta/system-ui in the brief window before
   the lazy-loaded stylesheet finishes downloading, rather than showing
   empty glyph boxes. */
html[data-script="kannada"] {
  --font-display: "Noto Sans Kannada", "Mukta", sans-serif;
  --font-body: "Noto Sans Kannada", system-ui, sans-serif;
}
html[data-script="malayalam"] {
  --font-display: "Noto Sans Malayalam", "Mukta", sans-serif;
  --font-body: "Noto Sans Malayalam", system-ui, sans-serif;
}
html[data-script="tamil"] {
  --font-display: "Noto Sans Tamil", "Mukta", sans-serif;
  --font-body: "Noto Sans Tamil", system-ui, sans-serif;
}
html[data-script="telugu"] {
  --font-display: "Noto Sans Telugu", "Mukta", sans-serif;
  --font-body: "Noto Sans Telugu", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(31,77,44,0.035) 0px,
      rgba(31,77,44,0.035) 2px,
      transparent 2px,
      transparent 14px
    ),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  padding-bottom: 40px;
}

/* ---------- Ticker (signature element) ---------- */
.ticker {
  /* MOVED: was a static strip at the very top of the page. Now fixed
     directly above the bottom nav so the ticker + nav read as one
     cohesive bottom unit, rather than the ticker sitting alone at the
     top while the bottom half of the screen looked empty. Height here
     (~35px) is accounted for in main's bottom padding below. */
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(66px + env(safe-area-inset-bottom, 0px)); /* sits directly on top of the nav bar */
  z-index: 900; /* same layer as the nav — both below every modal/overlay (1000+) */
  background: var(--board-green);
  overflow: hidden;
  white-space: nowrap;
  border-top: 3px solid var(--marigold); /* border moved to the top edge, since it now sits above the nav rather than below a header */
}
.ticker__track {
  display: inline-block;
  padding: 8px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--marigold);
  animation: scroll-ticker 32s linear infinite;
}
.ticker__track span { margin-right: 40px; }
.ticker__track .up::before { content: "▲ "; color: #7fd88f; }
.ticker__track .down::before { content: "▼ "; color: #ff8a80; }
@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
}
.app-header__brand { display: flex; align-items: center; gap: 10px; }
.app-header__icon {
  width: 34px;
  height: 34px;
  color: var(--board-green-light);
  flex: none;
}
.app-header__mark {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  color: var(--board-green-light);
  letter-spacing: 0.04em;
}
.app-header h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0;
  color: var(--ink);
}
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.help-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--board-green);
  background: var(--card);
  color: var(--board-green);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.help-btn:active { transform: scale(0.94); }

.lang-toggle {
  border: 2px solid var(--board-green);
  background: var(--card);
  color: var(--board-green);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-toggle:active { transform: scale(0.96); }

/* ---------- Main menu (Explore Mandi / My Dashboard) ---------- */
.main-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900; /* above regular page content, below every modal/overlay (1000+) so opening one correctly covers it */
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.main-nav__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--muted-ink);
  font-family: var(--font-display);
  font-weight: 700;
  padding: 6px 4px;
  border-radius: 12px;
  cursor: pointer;
}
.main-nav__icon {
  font-size: 20px;
  line-height: 1;
  filter: grayscale(1) opacity(0.6); /* muted for the inactive tab, matching the muted label color */
  /* Animated so the icon settles into place when a tab becomes active,
     rather than snapping — see the keyframes below. */
  transition: filter 0.25s ease, transform 0.25s ease;
}
.main-nav__label {
  font-size: 11.5px;
  letter-spacing: 0.01em;
}
.main-nav__btn.active {
  /* FIXED: was rgba(31,77,44,0.1) — a 10% tint measured only 1.18:1
     against the white nav background, which is effectively invisible.
     A solid pill gives 9.74:1 for the white label on green, well clear
     of WCAG AA's 4.5:1, and makes the selected tab unmistakable. */
  background: var(--board-green);
  color: #fff;
}
.main-nav__btn.active .main-nav__icon {
  filter: none; /* full-color icon only for the active tab */
}

/* Per-tab animations — each icon animates in a way that matches what it
   represents, rather than sharing one generic bounce. Targeted by button
   ID since the motion differs per tab. */

/* Explore Mandi — the crop sprouts: starts small and squashed at the
   base (as if pushing up out of soil), stretches upward past its final
   size, then settles. transform-origin at the bottom is what sells the
   "growing from the ground" read rather than just scaling in place. */
#navExploreBtn.active .main-nav__icon {
  transform-origin: bottom center;
  animation: navSprout 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
}
@keyframes navSprout {
  0% { transform: scaleY(0.3) scaleX(0.8) translateY(4px); opacity: 0.4; }
  45% { transform: scaleY(1.2) scaleX(1.05) translateY(-2px); opacity: 1; }
  70% { transform: scaleY(0.95) scaleX(1) translateY(0); }
  100% { transform: scaleY(1) scaleX(1) translateY(0); }
}

/* My Dashboard — the star spins and shines: one full rotation paired
   with a marigold glow that peaks mid-spin and fades out, so the
   "shine" reads as part of the spin rather than a separate effect. */
#navDashboardBtn.active .main-nav__icon {
  animation: navStarSpin 0.7s ease-out;
}
@keyframes navStarSpin {
  0% {
    transform: rotate(0deg) scale(1);
    filter: drop-shadow(0 0 0 rgba(227, 160, 8, 0));
  }
  40% {
    transform: rotate(200deg) scale(1.3);
    filter: drop-shadow(0 0 8px rgba(227, 160, 8, 0.95));
  }
  70% {
    transform: rotate(330deg) scale(1.05);
    filter: drop-shadow(0 0 5px rgba(227, 160, 8, 0.6));
  }
  100% {
    transform: rotate(360deg) scale(1);
    filter: drop-shadow(0 0 0 rgba(227, 160, 8, 0));
  }
}

/* More — kept as the simple pop, since a hamburger icon has no natural
   metaphor to animate the way a sprouting crop or spinning star does. */
#navMoreBtn.active .main-nav__icon {
  animation: navIconPop 0.4s ease-out;
}
@keyframes navIconPop {
  0% { transform: scale(1) translateY(0); }
  40% { transform: scale(1.25) translateY(-3px); }
  70% { transform: scale(0.95) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}

/* Slight press-in on any tab — immediate tactile feedback even before
   the view actually switches. */
.main-nav__btn:active .main-nav__icon {
  transform: scale(0.88);
}
.main-nav__btn:active { transform: scale(0.95); }
@media (prefers-reduced-motion: reduce) {
  .main-nav__icon { transition: none; }
  /* Must match the ID-based specificity of the animation rules above —
     a plain .class selector here would lose to #navExploreBtn etc. and
     the override would silently do nothing. */
  #navExploreBtn.active .main-nav__icon,
  #navDashboardBtn.active .main-nav__icon,
  #navMoreBtn.active .main-nav__icon { animation: none; }
  .main-nav__btn:active .main-nav__icon { transform: none; }
}

/* ---------- "More" sheet ----------
   Slides up from just above the nav. Not a full-screen modal — these
   are quick secondary actions, so covering the whole app for them
   would be disproportionate. */
.more-sheet {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(104px + env(safe-area-inset-bottom, 0px)); /* clears both the nav and the ticker above it */
  z-index: 950; /* above nav/ticker (900), below every modal (1000+) */
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  padding: 6px;
  max-width: 464px;
  margin: 0 auto;
  animation: moreSheetIn 0.22s ease-out;
}
.more-sheet[hidden] { display: none; }
@keyframes moreSheetIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.more-sheet__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  text-align: left;
  text-decoration: none;
  padding: 13px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.more-sheet__item:active { background: var(--line); }
.more-sheet__icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  font-size: 18px;
}
@media (prefers-reduced-motion: reduce) {
  .more-sheet { animation: none; }
}

/* Content needs room at the bottom so neither the fixed nav nor the
   ticker sitting above it ever covers the last row/card. Accounts for
   nav (~66px) + ticker (~35px) + safe-area inset + breathing room. */
main {
  max-width: 480px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: calc(115px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Filters ---------- */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0 18px;
}
.filter-field label {
  display: block;
  font-size: 12px;
  color: var(--muted-ink);
  margin-bottom: 4px;
  font-weight: 600;
}
.filter-field select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
}
.filter-field select:focus-visible {
  outline: 3px solid var(--marigold);
  outline-offset: 1px;
}
.filter-field select:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---------- Loading state ---------- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--muted-ink);
  font-size: 14px;
  text-align: center;
}

/* A little wave of crop icons bouncing in sequence, standing in for the
   old plain spinner ring — same "something is happening" job, but
   actually worth looking at instead of tuning out. Uses crops already
   familiar from the rate board itself (wheat, tomato, onion, potato,
   chili) so it reads as "on-brand", not generic. */
.loading-crops {
  display: flex;
  gap: 10px;
  font-size: 26px;
  line-height: 1;
}
.loading-crops span {
  display: inline-block;
  animation: cropBounce 1.1s ease-in-out infinite;
}
.loading-crops span:nth-child(1) { animation-delay: 0s; }
.loading-crops span:nth-child(2) { animation-delay: 0.11s; }
.loading-crops span:nth-child(3) { animation-delay: 0.22s; }
.loading-crops span:nth-child(4) { animation-delay: 0.33s; }
.loading-crops span:nth-child(5) { animation-delay: 0.44s; }

@keyframes cropBounce {
  0%, 100% { transform: translateY(0) scale(0.82); opacity: 0.4; }
  35% { transform: translateY(-12px) scale(1.15); opacity: 1; }
  65% { transform: translateY(0) scale(0.92); opacity: 0.65; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-crops span {
    animation: cropPulse 1.6s ease-in-out infinite;
  }
  @keyframes cropPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }
}

/* ---------- Listen hero ---------- */
.listen-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--board-green);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.listen-hero::after {
  /* faint decorative sound-wave, purely ornamental, low-contrast */
  content: "";
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(227,160,8,0.08);
}
.play-button {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--marigold);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}
.play-button svg { width: 28px; height: 28px; fill: var(--board-green); }
.play-button:active { transform: scale(0.94); }
.play-button.playing { background: #fff; }
.play-button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.listen-hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: #fff;
}
.listen-hero__sub {
  font-size: 13px;
  color: #cfe3d2;
  margin-top: 2px;
}

/* equalizer: four bars, still by default, animate only while playing —
   real state feedback, not decoration for its own sake */
.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  flex: none;
  z-index: 1;
}
.equalizer span {
  width: 4px;
  height: 6px;
  background: var(--marigold);
  border-radius: 2px;
  opacity: 0.45;
}
.listen-hero.is-playing .equalizer span {
  animation: eq-bounce 0.9s ease-in-out infinite;
  opacity: 1;
}
.equalizer span:nth-child(1) { animation-delay: 0s; }
.equalizer span:nth-child(2) { animation-delay: 0.15s; }
.equalizer span:nth-child(3) { animation-delay: 0.3s; }
.equalizer span:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq-bounce {
  0%, 100% { height: 6px; }
  50% { height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .listen-hero.is-playing .equalizer span { animation: none; height: 16px; }
}

/* ---------- Search row ---------- */
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
#cropSearch {
  flex: 1;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
}
#cropSearch:focus-visible { outline: 3px solid var(--marigold); }
#cropSearch:disabled {
  opacity: 0.6;
  cursor: wait;
}
/* ---------- Board banner (screenshot-safe date + brand) ---------- */
.board-banner {
  background: var(--card);
  border: 2px solid var(--board-green);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
}
.board-banner__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.board-banner__brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--board-green-light);
  text-transform: uppercase;
}
.board-banner__date-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.board-banner__date-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted-ink);
  text-transform: uppercase;
}
.board-banner__date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  background: #fdf3dc;
  padding: 4px 9px;
  border-radius: 999px;
}
.board-banner__date svg {
  width: 14px;
  height: 14px;
  color: var(--marigold);
  flex: none;
}
.board-banner__mandi {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  margin-top: 4px;
}

/* ---------- My Dashboard ---------- */
.dashboard-header {
  margin: 6px 0 16px;
}
.dashboard-header__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--ink);
}
.dashboard-header__sub {
  font-size: 13px;
  color: var(--muted-ink);
  margin: 0;
  line-height: 1.5;
}

/* ---------- Daily notification settings ---------- */
.notify-settings {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.notify-settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notify-settings__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.notify-settings__sub {
  font-size: 12.5px;
  color: var(--muted-ink);
  margin-top: 2px;
  line-height: 1.4;
}

/* Custom toggle switch — a plain checkbox styled to look like a native
   mobile switch, since <input type="checkbox"> alone doesn't read as
   "on/off" the way this feature needs it to at a glance. */
.notify-toggle {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
}
.notify-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.notify-toggle__track {
  display: block;
  width: 46px;
  height: 26px;
  background: var(--line);
  border-radius: 999px;
  transition: background 0.15s ease;
}
.notify-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
.notify-toggle input:checked ~ .notify-toggle__track {
  background: var(--board-green);
}
.notify-toggle input:checked ~ .notify-toggle__track .notify-toggle__thumb {
  transform: translateX(20px);
}
.notify-toggle input:disabled ~ .notify-toggle__track {
  opacity: 0.6;
}

.notify-settings__time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.notify-settings__time-row label {
  font-size: 13px;
  color: var(--muted-ink);
  font-weight: 600;
}
.notify-settings__time-row input[type="time"] {
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
}

/* ---------- Rate board (price list) ---------- */
.rate-board { display: flex; flex-direction: column; gap: 10px; }

.rate-row {
  position: relative;
  /* REVAMPED: previous attempts (a faint color wash across the whole
     card, a thin left accent bar, a small circular/squircle icon badge)
     were all still reading as "the same shape of card" as a competitor
     app, just with different colors. This is a structural change
     instead of another color tweak: a wide, full-height colored panel
     replaces the old thin-bar-plus-small-badge combo entirely. See
     .rate-row__icon below for the panel itself. */
  background: var(--card);
  border-radius: var(--radius);
  padding: 0 40px 0 0;
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 2px solid transparent;
  overflow: hidden; /* keeps the icon panel's square corners clipped to the card's own rounded corners */
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  /* Staggered list entrance — animation-delay is set per row via JS
     (see buildRateRow in app.js) so rows cascade in one after another
     rather than all appearing at once. backwards fill-mode keeps a row
     invisible during its own delay instead of flashing visible first. */
  animation: rateRowEntrance 0.35s ease-out backwards;
}
@keyframes rateRowEntrance {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .rate-row { animation: none; }
}
.rate-row:active { transform: scale(0.98); }
.rate-row.speaking {
  border-color: var(--marigold);
  border-left-color: var(--marigold);
  transform: scale(1.015);
}
.rate-row__icon {
  flex: none;
  /* REVAMPED: was a small 44px circular/squircle badge sitting inside
     the card's own padding — near-identical in concept to a
     competitor's small icon-in-circle treatment, just a different
     shape. This is now a wide, full-height color block that IS the
     card's left edge, not a small decoration floating inside it — a
     genuinely different silhouette at a glance, not just a different
     badge shape. */
  width: 76px;
  align-self: stretch;
  background: var(--accent, var(--line));
  border-radius: 0; /* .rate-row's own overflow:hidden clips this to match the card's rounded corners */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.rate-row__left { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 12px 0 12px 14px; }
.rate-row__crop {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  /* FIXED: no word-wrap was set, so long names like "Arecanut
     (Betelnut/Supari)" ran over the price column on narrow screens.
     word-break: break-word as a fallback handles edge cases where the
     browser's overflow-wrap support is patchy. */
  overflow-wrap: break-word;
  word-break: break-word;
}
.rate-row__meta {
  font-size: 12.5px;
  color: var(--muted-ink);
  margin-top: 3px;
}
/* ADDED 2026-10-02: "Press back again to exit" toast. Dark neutral so it
   reads as a system hint rather than a data/status message (the green
   fav-toast confirms a saved star). White on #263238 is ~14:1. Sits above
   every overlay and ignores taps so it can never block the screen. */
.back-toast {
  position: fixed;
  left: 50%;
  bottom: calc(115px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  z-index: 1300;
  background: #263238;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font: 600 14px var(--font-body);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  max-width: calc(100% - 40px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.back-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ADDED 2026-10-01: "showing saved prices" note and the slow-load retry.
   Neutral blue-grey (not the amber used for stale data) because this says
   "this is the previous visit's copy, refresh in progress", a different
   meaning from "this data is old at its source". #37474f on #e6edf1 is
   ~8:1. */
.snapshot-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #e6edf1;
  color: #37474f;
  border-left: 4px solid #78909c;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}
.snapshot-note[hidden] { display: none; }
.slow-load { text-align: center; padding: 28px 16px; color: var(--muted-ink); font-weight: 600; line-height: 1.5; }
.slow-retry-btn {
  margin-top: 12px;
  min-height: 44px;
  padding: 10px 18px;
  background: var(--board-green);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font: 700 14px var(--font-body);
  cursor: pointer;
}

/* ADDED 2026-09-30: notice shown when a mandi's latest prices are 4+
   days old (see updateStaleNotice in app.js). Amber family, matching the
   existing stale-row badge, so "amber = this data is behind" stays one
   consistent meaning across the app. #7a5200 on #fff3d6 measured below. */
.stale-notice {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #fff3d6;
  color: #7a5200;
  border-left: 4px solid var(--marigold);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.stale-notice[hidden] { display: none; }

/* ADDED 2026-09-30: MSP comparison line under the variety/range line.
   Plain coloured text, NOT a pill: the pill-on-cream approach was
   already found to be nearly invisible elsewhere in this app (see the
   crop-meta.js badge fix), and this line carries a number a farmer
   should actually read, so it gets real text contrast instead.
   Colours reuse the app's own trend tokens, all measured >= 5.1:1 on the
   white card (fall 5.44, rise 5.13, muted 5.69 — WCAG AA is 4.5). */
.rate-row__msp {
  font-size: 12px;
  font-weight: 700;
  margin-top: 3px;
  line-height: 1.3;
  overflow-wrap: break-word;
}
.rate-row__msp--below { color: var(--fall); }
.rate-row__msp--above { color: var(--rise); }
.rate-row__msp--at,
.rate-row__msp--upcoming { color: var(--muted-ink); font-weight: 600; }
.rate-row__stale {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  color: #a1710a;
  background: #fff3d6;
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 4px;
}
/* ADDED 2026-09-29: neutral variant of the badge above, used on
   multi-mandi lists (My Dashboard, regional search) where the date is
   simply a statement of when that row last reported — not a warning
   that it's lagging behind a reference date, which is what the amber
   styling means on a single-mandi board. Same geometry, so rows keep an
   identical layout either way; only the color language differs.

   Colors are crop-meta.js's "other" category pair rather than a new
   invention — that palette was already tuned once against this page's
   cream #FAF6EC for exactly this "is the pill actually visible"
   problem, so reusing it keeps one consistent neutral in the app
   instead of two near-identical grays. Measured: #37474f on #cfd8dc is
   6.67:1 (passes WCAG AA and AAA for this size), and the pill separates
   from the page background at 1.34:1 — low in absolute terms, but
   noticeably better than the existing amber pill's 1.02:1, so if this
   one reads as a pill the amber one certainly does. */
.rate-row__stale--asof {
  color: #37474f;
  background: #cfd8dc;
}
.rate-row__right {
  text-align: right;
  padding: 12px 0;
  /* Prevents the price chip being squeezed to zero when a long crop
     name fills all available space — the left column has flex:1 which
     would otherwise eat everything, so the right column needs an
     explicit floor. 90px comfortably fits "₹30,000" at the current
     font size on all supported locales. */
  flex: none;
  min-width: 90px;
}
.rate-row__price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  /* FIXED: was plain text with no background at all — every crop's
     price looked identical regardless of category. A chip in the row's
     own accent color ties the price back to the same hue as the icon
     and left bar, and gives the price itself a distinct "tag" identity
     instead of just being right-aligned numbers in empty space.
     inline-block so the chip hugs the text rather than stretching to
     the row's full width. */
  display: inline-block;
  background: color-mix(in srgb, var(--accent, var(--line)) 16%, transparent);
  padding: 3px 10px;
  border-radius: 10px;
}
.rate-row__unit { font-size: 11.5px; color: var(--muted-ink); }
.rate-row__trend {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  /* Fades in slightly after its own row's entrance finishes (the exact
     delay is set inline per row via JS — see buildRateRow), so the
     trend arrow reads as "confirming" the price a beat after it
     appears, rather than everything landing in one flat instant. */
  animation: rateRowTrendReveal 0.3s ease-out backwards;
}
@keyframes rateRowTrendReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .rate-row__trend { animation: none; }
}
.rate-row__trend.up { color: var(--rise); }
.rate-row__trend.down { color: var(--fall); }
.rate-row__trend.flat { color: var(--flat); }

.rate-row__star {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--paper);
  color: var(--line);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.rate-row__star.is-watched { color: var(--marigold); }
.rate-row__star:active { transform: scale(0.9); }
/* ENHANCED: starring a crop is presented as a genuinely meaningful
   action (it's how someone builds their whole Dashboard), so this pop
   was made more noticeable — bigger scale, a brief marigold glow, and
   a slight settle-wiggle — paired with the fav-toast confirmation
   below. Still JS-managed (animationend listener in the click
   handler), not a permanent class, so it can replay every time without
   needing a reflow trick. */
@keyframes ratingStarPop {
  0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(227, 160, 8, 0)); }
  35% { transform: scale(1.55) rotate(-8deg); filter: drop-shadow(0 0 6px rgba(227, 160, 8, 0.8)); }
  60% { transform: scale(1.15) rotate(4deg); filter: drop-shadow(0 0 3px rgba(227, 160, 8, 0.5)); }
  100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(227, 160, 8, 0)); }
}
.rate-row__star--pop {
  animation: ratingStarPop 0.5s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .rate-row__star--pop { animation: none; }
}

/* ---------- Favorite-added toast ----------
   A brief, non-blocking confirmation that a crop was actually saved —
   the star's own pop is easy to miss on a quick tap, so this gives a
   second, more deliberate signal that reads as "this mattered", without
   blocking interaction with the rest of the page the way a modal would. */
.fav-toast {
  position: fixed;
  left: 50%;
  bottom: calc(115px + env(safe-area-inset-bottom, 0px)); /* clears both the fixed nav (~66px) and the ticker (~35px) above it */
  transform: translateX(-50%) translateY(0);
  z-index: 1200; /* above every other overlay (max elsewhere is 1100) so it's never hidden behind one */
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--board-green);
  color: #fff;
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: calc(100% - 40px);
  animation: favToastIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.fav-toast[hidden] { display: none; }
.fav-toast.fav-toast--leaving {
  animation: favToastOut 0.25s ease-in forwards;
}
@keyframes favToastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes favToastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(16px); }
}
.fav-toast__icon {
  color: var(--marigold);
  font-size: 18px;
  flex: none;
}
.fav-toast__text {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-toast__action {
  flex: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
}
.fav-toast__action:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) {
  .fav-toast { animation: none; }
  .fav-toast.fav-toast--leaving { animation: none; }
}

/* Shown only on Dashboard rows, where a crop's mandi isn't otherwise
   obvious the way it is on Explore (where one mandi is always selected). */
.rate-row__mandi {
  font-size: 11px;
  font-weight: 700;
  color: var(--board-green-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.empty-state {
  text-align: center;
  color: var(--muted-ink);
  padding: 30px 10px;
  font-size: 14px;
}

/* ---------- Regional fallback (not traded here, but elsewhere in state) ---------- */
.regional-results {
  margin-top: 8px;
}
.regional-results__header {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-ink);
  text-align: center;
  padding: 10px 14px;
  margin: 0 0 10px;
  background: #fdf3dc;
  border-radius: var(--radius);
}

.app-footer {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-ink);
  margin-top: 30px;
  padding: 0 20px;
}
.donate-link {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: 1px solid var(--line);
  color: var(--board-green-light);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none; /* this class is now also used on an <a> tag (the feedback link) — without this it would show a default underline a <button> never had */
  width: fit-content;
}
.donate-link:active { transform: scale(0.97); }

/* ---------- Donation modal ---------- */
.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.65);
  z-index: 1000;
  padding: 20px;
}
.donate-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.donate-card {
  position: relative;
  background: var(--paper);
  border-radius: 20px;
  padding: 30px 24px 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.donate-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.donate-card__icon { font-size: 36px; margin-bottom: 6px; }
.donate-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 0 0 10px;
  color: var(--ink);
}
.donate-card__sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted-ink);
  margin: 0 0 20px;
}
.donate-card__amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.donate-chip {
  background: #fff;
  border: 2px solid var(--line);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 0;
  border-radius: 10px;
  cursor: pointer;
}
.donate-chip.active {
  background: var(--marigold);
  border-color: var(--marigold);
  color: var(--ink);
}
.donate-card__amount-row {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 4px 12px;
  margin-bottom: 14px;
}
.donate-card__amount-row.input-error {
  border-color: var(--fall);
}
.donate-card__rupee {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--muted-ink);
  margin-right: 4px;
}
.donate-card__amount-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 0;
  background: transparent;
  color: var(--ink);
}

.donate-card__upi {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e7f0e8;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.donate-card__upi-id {
  flex: 1;
  text-align: left;
  font-family: monospace;
  font-size: 13px;
  color: var(--board-green-light);
  font-weight: 700;
  word-break: break-all;
}
.donate-card__copy {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--board-green-light);
  background: #fff;
  border: 1px solid var(--board-green-light);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}
.donate-card__pay-btn {
  display: block;
  width: 100%;
  background: var(--board-green);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  border: none;
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}
.donate-card__pay-btn:active { transform: scale(0.97); }
.donate-card__pay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.donate-card__qr-wrap {
  margin: 4px 0 14px;
  text-align: center;
}
.donate-card__qr-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.donate-card__qr-canvas {
  display: inline-block;
  padding: 10px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
}
.donate-card__qr-canvas img,
.donate-card__qr-canvas table {
  display: block;
}
.donate-card__qr-hint {
  font-size: 12px;
  color: var(--muted-ink);
  margin: 0 0 14px;
  line-height: 1.4;
}
.donate-card__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-ink);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 4px 0 14px;
}
.donate-card__divider::before,
.donate-card__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.donate-card__spread-label {
  font-size: 13px;
  color: var(--muted-ink);
  margin: 0 0 12px;
}
.donate-card__spread-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  /* display set only in :not([hidden]) below — same pattern as every
     other conditionally-shown element in this app now, after finding
     the same bug three separate times in this file. */
}
.donate-card__spread-btn:not([hidden]) {
  display: flex;
}
.donate-card__spread-btn:active { transform: scale(0.97); }

/* ---------- Loyalty donation prompt ----------
   Deliberately warmer/more prominent than the standard donate-card
   above — this only ever appears once, at a moment earned by genuine
   usage, so it's allowed to feel like a small occasion rather than
   blend in as just another modal. */
.loyalty-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.7);
  z-index: 1100; /* above the standard donate/trend/walkthrough overlays (1000) in the rare case both could be open */
  padding: 20px;
}
.loyalty-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.loyalty-card {
  position: relative;
  background: linear-gradient(180deg, #fffdf7 0%, var(--paper) 55%);
  border-radius: 24px;
  padding: 36px 26px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(227, 160, 8, 0.25); /* faint marigold edge, not a hard line */
  animation: loyaltyCardIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes loyaltyCardIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.loyalty-card__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.loyalty-card__icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 14px;
  /* a gentle, slow sway rather than a static emoji — draws the eye
     without feeling frantic; respects reduced-motion below */
  animation: loyaltySway 2.6s ease-in-out infinite;
}
@keyframes loyaltySway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
.loyalty-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 12px;
}
.loyalty-card__body {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted-ink);
  margin: 0 0 22px;
}
.loyalty-card__cta {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--marigold);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(227, 160, 8, 0.35);
  margin-bottom: 12px;
}
.loyalty-card__cta:active { transform: scale(0.98); }
.loyalty-card__later {
  display: block;
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--muted-ink);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
}
@media (prefers-reduced-motion: reduce) {
  .loyalty-card { animation: none; }
  .loyalty-card__icon { animation: none; }
}

/* ---------- Crop trend panel (slide-up) ---------- */
.trend-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.65);
  z-index: 1000;
  /* display set only in :not([hidden]) below — same reasoning as every
     other overlay in this file: a plain .trend-overlay { display: X }
     rule here would beat the browser's default [hidden] { display: none }
     at equal specificity and silently break hiding it again. */
}
.trend-overlay:not([hidden]) {
  display: block;
}
.trend-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* FIXED 2026-09-01: this had no max-width, so on a wide desktop
     browser window the panel (and the chart's SVG inside it, which
     scales to fill 100% of its container) stretched to the full
     viewport width — hugely oversized and out of proportion compared
     to how it was actually designed to look. 480px matches the same
     cap already used everywhere else in this app (see `main` above) —
     the panel still reads as a full-width bottom sheet on any phone
     screen narrower than that, and becomes a sensibly-sized, centered
     card on anything wider. */
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 8px 20px 26px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.3);
  /* Slides up from fully off-screen. The overlay's :not([hidden]) rule
     (not a separate class toggle) drives this, so opening/closing stays
     in sync with the same hidden-attribute pattern the rest of the app
     already uses — no extra JS state to keep in sync. */
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.trend-overlay:not([hidden]) .trend-panel {
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .trend-panel { transition: none; }
}
.trend-panel__handle {
  width: 40px;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin: 8px auto 12px;
}
.trend-panel__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.trend-panel__share {
  position: absolute;
  top: 14px;
  right: 56px; /* sits just left of the close button, same row */
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.trend-panel__share svg { display: block; }
.trend-panel__share:active { transform: scale(0.94); }
.trend-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trend-panel__icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.trend-panel__crop {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  line-height: 1.1;
}
.trend-panel__variety {
  font-size: 13px;
  color: var(--muted-ink);
  margin-top: 2px;
}
.trend-panel__current {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 4px;
}
.trend-panel__current-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  font-variant-numeric: tabular-nums; /* fixed-width digits — keeps the number from jittering side to side as it counts up */
  color: var(--ink);
}
/* Retriggered via JS (restartAnimation in app.js) every time the panel
   opens for a different crop, since this is the same reused DOM element
   each time, not a fresh one like rows/bars — a plain CSS animation on
   the base class wouldn't replay on its own without that. */
@keyframes trendPriceReveal {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.trend-panel__current-price--reveal {
  animation: trendPriceReveal 0.35s ease-out;
}

/* Shared "fades in a beat after the price" class — used for the trend
   panel's arrow/percentage. The built-in delay is what makes it land
   just after the price above it settles in. */
@keyframes trendRevealDelayed {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.trend-reveal-delayed {
  animation: trendRevealDelayed 0.3s ease-out 0.2s backwards;
}

@media (prefers-reduced-motion: reduce) {
  .trend-panel__current-price--reveal,
  .trend-reveal-delayed {
    animation: none;
  }
}

.trend-panel__current-trend {
  font-size: 13.5px;
  font-weight: 700;
}
.trend-panel__current-trend.up { color: var(--rise); }
.trend-panel__current-trend.down { color: var(--fall); }
.trend-panel__current-trend.flat { color: var(--flat); }

.trend-panel__chart-wrap {
  margin: 14px 0 10px;
  min-height: 190px; /* matches renderTrendChartSVG's height in app.js */
  display: flex;
  /* FIXED: this container was designed with a single child (the chart
     SVG alone) in mind, so flex's default row direction never mattered.
     Once a second caption paragraph was added above the chart, "row"
     laid the caption text and the chart SIDE BY SIDE instead of
     stacking them — exactly the broken layout in the screenshot.
     Column stacks them top to bottom as intended. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.trend-panel__chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}
/* Subtle entrance animation each time a trend chart renders — each bar
   rises from the baseline it sits on, staggered slightly left to right
   so they cascade up rather than all popping in at once, and each
   day's min–max whisker fades in just after its own bar lands.

   transform-box: fill-box + transform-origin: bottom is what makes a
   single shared animation correctly scale every bar up from ITS OWN
   bottom edge, regardless of that bar's individual height or position —
   without this, scaleY() would scale from the SVG viewport's origin
   instead, which would slide bars sideways and downward as well as
   scaling them, not grow them cleanly upward in place. */
.trend-chart__bar {
  fill: var(--board-green);
  transform-box: fill-box;
  transform-origin: bottom;
  animation: trendBarGrow 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.trend-chart__bar--last { fill: var(--marigold); }
@keyframes trendBarGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.trend-chart__whisker {
  stroke: var(--muted-ink);
  stroke-width: 1.5;
  opacity: 0;
  animation: trendWhiskerFadeIn 0.3s ease forwards;
}
@keyframes trendWhiskerFadeIn {
  to { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .trend-chart__bar,
  .trend-chart__whisker {
    animation: none;
  }
  .trend-chart__whisker { opacity: 0.55; }
}
.trend-chart__axis-label,
.trend-chart__price-label {
  font-family: var(--font-body);
  font-size: 9.5px;
  fill: var(--muted-ink);
}

/* Faint reference lines behind the bars, one per price tick — much
   lighter than the axis lines themselves so they read as background
   structure, not competing data. */
.trend-chart__gridline {
  stroke: var(--line);
  stroke-width: 1;
}

/* The actual X and Y axis lines — solid, slightly more visible than the
   gridlines, so "this is where the axes are" is unambiguous even before
   reading any of the numbers. */
.trend-chart__axis-line {
  stroke: var(--muted-ink);
  stroke-width: 1;
  opacity: 0.4;
}

.trend-chart__axis-tick {
  stroke: var(--muted-ink);
  stroke-width: 1;
  opacity: 0.4;
}

/* ADDED 2026-09-30: MSP line inside the trend panel (reuses the
   .rate-row__msp colour classes) and the "compare with other mandis"
   section. Colours are the app's own tokens; .up/.down/.flat reuse the
   existing trend colours (>= 5.1:1 on white, measured). */
.trend-panel__msp { margin: 2px 0 10px; }
.trend-panel__msp[hidden] { display: none; }
.trend-panel__msp .rate-row__msp { font-size: 13px; }

/* ADDED 2026-09-30: price-alert block in the trend panel. Inputs are
   >= 44px tall for a thumb, and 16px font so iOS doesn't zoom the page
   on focus. Message colours reuse --rise/--fall (>= 5.1:1 on white). */
.trend-panel__alert { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.trend-panel__alert[hidden],
.trend-alert__need[hidden],
.trend-alert__fields[hidden] { display: none; }
.trend-alert__title { font: 700 13px var(--font-body); color: var(--muted-ink); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.trend-alert__fields { display: flex; flex-direction: column; gap: 10px; }
.trend-alert__field { display: flex; flex-direction: column; gap: 4px; font: 600 13px var(--font-body); color: var(--ink); }
.trend-alert__field input {
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font: 600 16px var(--font-body);
  background: #fff;
  color: var(--ink);
}
.trend-alert__field input:focus { outline: none; border-color: var(--board-green); }
.trend-alert__save,
.trend-alert__go {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--board-green);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font: 700 14px var(--font-body);
  cursor: pointer;
}
.trend-alert__save:disabled { opacity: 0.55; cursor: default; }
.trend-alert__msg { margin: 8px 0 0; font-size: 13px; font-weight: 600; line-height: 1.4; min-height: 0; }
.trend-alert__msg--ok { color: var(--rise); }
.trend-alert__msg--error { color: var(--fall); }
.trend-alert__need p { margin: 0 0 10px; font-size: 13px; color: var(--muted-ink); line-height: 1.4; }

.trend-panel__compare { margin-top: 18px; }
.trend-panel__compare[hidden] { display: none; }
.trend-panel__compare-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: #fff;
  color: var(--board-green);
  border: 2px solid var(--board-green);
  border-radius: var(--radius);
  font: 700 14px var(--font-body);
  cursor: pointer;
}
.trend-panel__compare-btn:disabled { opacity: 0.55; cursor: default; }
.trend-panel__compare-results[hidden] { display: none; }
.compare-heading {
  margin: 14px 0 6px;
  font: 700 13px var(--font-body);
  color: var(--muted-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.compare-list { list-style: none; margin: 0; padding: 0; }
.compare-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.compare-row__left { min-width: 0; }
.compare-row__mandi { font-weight: 700; overflow-wrap: break-word; }
.compare-row__sub { font-size: 12px; color: var(--muted-ink); margin-top: 2px; }
.compare-row__right { text-align: right; flex: none; }
.compare-row__price { font-weight: 800; font-size: 16px; }
.compare-row__delta { font-size: 12px; font-weight: 700; margin-top: 2px; }
.compare-row__delta.up { color: var(--rise); }
.compare-row__delta.down { color: var(--fall); }
.compare-row__delta.flat { color: var(--flat); }
.compare-note { margin: 8px 0 0; font-size: 11.5px; color: var(--muted-ink); line-height: 1.4; }
.trend-panel__legend {
  display: flex;
  gap: 18px;
  font-size: 11.5px;
  color: var(--muted-ink);
}
.trend-panel__swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.trend-panel__swatch--line { background: var(--board-green); } /* represents the bars — class name kept as-is from the line-chart era to avoid touching HTML/JS for a CSS-only rename */
.trend-panel__swatch--band { background: var(--muted-ink); opacity: 0.55; } /* represents the whisker — matches its actual muted-gray color, not the old translucent green band */

.trend-panel__empty {
  text-align: center;
  color: var(--muted-ink);
  font-size: 13.5px;
  padding: 24px 10px;
  line-height: 1.5;
  margin: 0;
}
/* Both captions sit directly above the chart. .trend-panel__progress
   existed in app.js before this change but had no styling of its own —
   fixed here alongside adding .trend-panel__context so the two read as
   a consistent pair rather than one styled and one not. */
.trend-panel__progress,
.trend-panel__context {
  text-align: center;
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 8px;
}

/* ---------- Accessibility floor ---------- */
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---------- First-visit location picker ---------- */
.onboard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.65);
  z-index: 1000;
  padding: 20px;
  /* display is set only in the :not([hidden]) rule below, so the
     browser's default [hidden] { display: none } always wins when the
     hidden attribute is present — a plain .onboard-overlay { display:
     flex } rule here would override it (same specificity, author styles
     load after the UA stylesheet), which is exactly what silently broke
     hiding the modal after clicking Continue. */
}
.onboard-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboard-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.onboard-card__icon { font-size: 40px; margin-bottom: 6px; }
.onboard-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  margin: 0 0 4px;
  color: var(--ink);
}
.onboard-card__sub {
  font-size: 13px;
  color: var(--muted-ink);
  margin: 0 0 20px;
}
.onboard-card .filter-field {
  text-align: left;
  margin-bottom: 14px;
}
.onboard-card__continue {
  width: 100%;
  margin-top: 8px;
  background: var(--board-green);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
}
.onboard-card__continue:active { transform: scale(0.97); }
.onboard-card__continue:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---------- Language picker ---------- */
.lang-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.65);
  z-index: 1000;
  padding: 20px;
  /* Same reasoning as every other overlay in this file: display is set
     only in :not([hidden]) below, so the browser's default
     [hidden] { display: none } always wins when the attribute is
     present. */
}
.lang-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-card {
  position: relative;
  background: var(--paper);
  border-radius: 20px;
  padding: 30px 22px 22px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.lang-card__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}
.lang-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  margin: 0 0 16px;
  color: var(--ink);
  text-align: center;
}
.lang-card__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lang-card__option {
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  padding: 13px 16px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
}
.lang-card__option.is-active {
  border-color: var(--board-green);
  background: #eaf1e6;
  color: var(--board-green);
  font-weight: 700;
}
.lang-card__option:active { transform: scale(0.98); }

@media (max-width: 360px) {
  .app-header h1 { font-size: 22px; }
  .rate-row__price { font-size: 21px; }
}

/* ---------- First-time walkthrough ---------- */
.walkthrough-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 30, 18, 0.65);
  z-index: 1000;
  padding: 20px;
  /* Same reasoning as every other overlay in this file: display is set
     only in :not([hidden]) below, so the browser's default
     [hidden] { display: none } always wins when the attribute is
     present. */
}
.walkthrough-overlay:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
}
.walkthrough-card {
  position: relative;
  background: var(--paper);
  border-radius: 20px;
  padding: 36px 24px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.walkthrough-card__skip {
  position: absolute;
  top: 14px;
  right: 16px;
  border: none;
  background: none;
  color: var(--muted-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.walkthrough-card__icon { font-size: 42px; margin-bottom: 8px; }
.walkthrough-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--ink);
}
.walkthrough-card__body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted-ink);
  margin: 0 0 22px;
  min-height: 63px; /* roughly 3 lines — keeps the card a stable height as slide text length varies, so Next/Back don't jump around */
}
.walkthrough-card__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}
.walkthrough-card__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
}
.walkthrough-card__dot.is-active {
  background: var(--board-green);
  width: 18px;
  border-radius: 4px;
}
.walkthrough-card__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.walkthrough-card__back {
  border: none;
  background: none;
  color: var(--muted-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 10px;
  cursor: pointer;
}
.walkthrough-card__next {
  flex: 1;
  background: var(--board-green);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: 12px;
  cursor: pointer;
}
.walkthrough-card__next:active { transform: scale(0.97); }

/* ADDED 2026-10-04: inside the Android WebView app only (html.native-app is
   set by app.js when the user-agent says KisanDailyApp). A WebView has no
   Web Push, so the daily-notification switch and the price-alert form could
   never work there; hide them rather than show controls that cannot succeed.
   In Chrome / an installed PWA / a TWA this class is absent and both stay
   visible - moving back to a TWA needs no change. */
html.native-app #notifySettings,
html.native-app .trend-panel__alert {
  display: none !important;
}

/* ADDED 2026-10-05 (Google Play "Misleading Claims" policy): the footer now
   carries real links to the official sources plus a plain disclaimer that the
   app is not a government app. The disclaimer uses the normal ink colour (not
   the muted grey of the source line) so it is easy to see; links are padded
   so each is a comfortable tap target. */
.app-footer__sources {
  margin: 10px 0 0;
  line-height: 1.9;
}
.app-footer__sources a {
  display: inline-block;
  padding: 2px 4px;
  color: var(--board-green);
  font-weight: 700;
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.app-footer__disclaimer {
  margin: 8px auto 0;
  max-width: 520px;
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--ink);
}


/* ADDED 2026-10-16: guided first-run tour. Steps that point at a real control
   get a highlight ring (the dim is the ring's huge box-shadow, so the control
   itself stays bright) and the card moves to whichever half of the screen the
   control is NOT in. Steps with no visible target keep the original centred
   card and full dim. */
/* two classes each, so they outrank .walkthrough-overlay:not([hidden]) above */
.walkthrough-overlay.walkthrough-overlay--spot { background: transparent; align-items: flex-end; }
.walkthrough-overlay.walkthrough-overlay--spot.walkthrough-overlay--top { align-items: flex-start; }
.walkthrough-spot {
  position: fixed;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(15, 30, 18, 0.72), 0 0 0 3px var(--marigold);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.walkthrough-spot[hidden] { display: none; }
.walkthrough-card__action {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  background: var(--marigold);
  color: var(--ink);
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  padding: 13px;
  border-radius: 12px;
  cursor: pointer;
}
.walkthrough-card__action[hidden] { display: none; }
.walkthrough-card__action:disabled { opacity: 0.8; cursor: default; }
