/* =====================================================
   Cornbelt AI — styles.css
   White minimalist palette with earthy green accent
   Agriculture × Technology aesthetic
   ===================================================== */

/* ---- Custom Properties ---- */
:root {
  /* Core palette — clean minimalist + agricultural green */
  --color-green:         #2E7D32;  /* primary rich field green */
  --color-green-mid:     #4CAF50;  /* accent green */
  --color-green-light:   #66BB6A;  /* lighter green */
  --color-green-pale:    #E8F5E9;  /* very pale green tint */
  --color-green-border:  #C8E6C9;  /* soft green border */

  /* Neutrals */
  --color-white:         #ffffff;
  --color-bg:            #F8F9FA;  /* soft off-white section background */
  --color-surface:       #ffffff;  /* card / tile surface */
  --color-border:        #E9ECEF;  /* subtle border */
  --color-text:          #1a1a1a;  /* near-black */
  --color-text-muted:    #6B7280;  /* muted secondary text */
  --color-text-light:    #9CA3AF;  /* light muted */

  /* Legacy aliases (for backward compat in chat/form CSS) */
  --color-soil:          #1a1a1a;
  --color-bark:          #F8F9FA;
  --color-field:         #2E7D32;
  --color-leaf:          #4CAF50;
  --color-sprout:        #66BB6A;
  --color-tan:           #6B7280;
  --color-straw:         #E8F5E9;
  --color-soy-gold:      #b07d2a;
  --color-error:         #dc2626;
  --color-sky-blue:      #2196f3;  /* weather / sky indicator */

  /* Typography */
  --font-heading: 'Inter', 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  --font-body:    'Inter', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;

  /* Spacing & shape */
  --radius:        18px;
  --radius-sm:     10px;
  --radius-pill:   50px;
  --shadow-sm:     0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow:        0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-md:     0 8px 24px rgba(0, 0, 0, 0.08);
  --max-width:     1200px;
  --section-pad:   5rem 1.5rem;
  /* Chat-specific heights */
  --chat-topbar-h:   50px;
  --chat-controls-h: 46px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.7;
}

main img { max-width: 100%; display: block; }

a {
  color: var(--color-green);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--color-green-mid); }

/* Screen-reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Layout ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-block;
  background-color: var(--color-green);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.btn-primary:hover {
  background-color: var(--color-green-mid);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(46, 125, 50, 0.30);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ====================================================
   HEADER
==================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 0 var(--color-border);
}

.site-header .logo-ear {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.site-header .logo-words {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-green);
  letter-spacing: 0.01em;
}


.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
  line-height: 1;
}

.logo-ear {
  height: 50px;
  width: auto;
  display: block;
}

.logo-words {
  height: 40px;
  width: auto;
  display: block;
}

.beta-badge {
  display: inline-block;
  background: var(--color-green-pale);
  color: var(--color-green);
  border: 1px solid var(--color-green-border);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.45rem;
  text-transform: uppercase;
}


.site-header nav {
  display: flex;
  gap: 1.75rem;
}

.site-header nav a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.site-header nav a:hover {
  color: var(--color-green);
}

/* ====================================================
   HERO
==================================================== */
.hero {
  background: linear-gradient(180deg, #ffffff 60%, #F1F8F1 100%);
  padding: 6rem 1.5rem 5rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;

  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2rem;
  text-align: left;
}

/* Subtle radial highlight — technical meets field */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(76, 175, 80, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero-illustration {
  position: relative;
  z-index: 1;
  width: 220px;
  max-width: 30vw;
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: end;

  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  padding: 1rem;
  overflow: hidden;
}

.hero-corn {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  transform: rotate(28deg);
  transform-origin: center;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.hero-illustration:hover .hero-corn {
  transform: rotate(28deg) scale(1.05);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.hero-label {
  display: inline-block;
  background-color: var(--color-green-pale);
  color: var(--color-green);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--color-green-border);
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.hero-description {
  max-width: 620px;
  margin: 0 auto 2.25rem;
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.hero-actions {
  display: inline-flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ====================================================
   LOGO SECTION
==================================================== */

/* --- Mobile Styles (Default) --- */
.waitlist-logo-ear {
  width: 40px; /* Slightly smaller for mobile phones */
  max-width: none;
  height: auto;
  transition: transform 0.3s ease; /* Adds a smooth feel on tap/hover */
}

.waitlist-logo-words {
  width: 110px; /* Compact for narrow screens */
  max-width: none;
  height: auto;
}

/* --- Desktop/Tablet Enhancements (Dynamic Scaling) --- */
@media (min-width: 381px) {
  .waitlist-logo-ear {
    width: 25px; /* Scales up for larger screens */
    max-width: none;
  }
  
  .waitlist-logo-words {
    width: 75px; /* Scales up for larger screens */
    max-width: none;
  }
}

/* --- Interactive "Dynamic" Touch --- */
.waitlist-branding:hover .waitlist-logo-ear {
  transform: scale(1.05) rotate(2deg); /* Subtle "pop" when hovered on desktop */
}

/* ====================================================
   SHARED SECTION STYLES
==================================================== */
h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.section-intro {
  max-width: 600px;
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

/* ====================================================
   WHAT IT DOES (light background)
==================================================== */
.section-light {
  padding: var(--section-pad);
  background-color: var(--color-bg);
}

.section-light h2 { color: var(--color-text); }

/* Feature list — tiles with rounded corners and drop shadow */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.feature-list li:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.feature-list strong {
  display: block;
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.feature-list p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ====================================================
   WHY IT'S DIFFERENT — light tiles, green accent
==================================================== */
.section-dark {
  padding: var(--section-pad);
  background-color: var(--color-white);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.section-dark h2 { color: var(--color-text); }
.section-dark .section-intro { color: var(--color-text-muted); }

/* Card grid — tiles with rounded corners and drop shadow */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  /* Uniform border — card titles use --color-green for visual differentiation */
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-green);
  margin-bottom: 0.6rem;
  letter-spacing: -0.005em;
}

.card p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ====================================================
   EMAIL SIGNUP
==================================================== */
.section-signup {
  padding: var(--section-pad);
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-green-pale) 100%);
  text-align: center;
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
}

.signup-inner h2 {
  color: var(--color-text);
  margin-bottom: 0.6rem;
}

.signup-inner > p {
  color: var(--color-text-muted);
  max-width: 500px;
  margin: 0 auto 2rem;
  font-size: 1.05rem;
}

.signup-form {
  max-width: 460px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-group input[type="email"] {
  flex: 1 1 220px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background-color: var(--color-white);
  color: var(--color-text);
  outline: none;
  transition: all 0.2s ease;
}

.form-group input[type="email"]:focus {
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.form-group input[type="email"].input-error {
  border-color: var(--color-error);
}

.form-message {
  min-height: 1.4em;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-message.success { color: var(--color-green); }
.form-message.error   { color: var(--color-error); }

/* ====================================================
   FOOTER
==================================================== */
.site-footer {
  background-color: var(--color-white);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.footer-dedication {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--color-text-muted);
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.footer-links a:hover {
  color: var(--color-green);
  border-color: var(--color-green);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
}

/* ====================================================
   CROP TOGGLE
==================================================== */
.crop-toggle {
  display: inline-flex;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 40px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 1.5rem;
}

.crop-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  border-radius: 36px;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.crop-btn:hover {
  color: var(--color-green);
}

.crop-btn.active {
  background-color: var(--color-green);
  color: var(--color-white);
}

.crop-btn[data-crop="soy"].active {
  background-color: var(--color-soy-gold);
}

/* ====================================================
   CHAT PAGE — TOP BAR (narrow, clean, chat-only)
==================================================== */
.site-header--chat .header-inner--chat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.25rem;
}

/* Account dropdown */
.account-dropdown-wrap {
  position: relative;
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.account-btn:hover {
  background: var(--color-green-pale);
  border-color: var(--color-green-border);
  color: var(--color-green);
}

.account-btn-icon { font-size: 1rem; }
.account-btn-caret { font-size: 0.7rem; color: var(--color-text-light); }

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
}

.account-dropdown-info {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  word-break: break-all;
}

.account-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.account-dropdown-item:hover {
  background: var(--color-bg);
  color: var(--color-green);
}

.account-dropdown-logout {
  color: var(--color-error);
}

.account-dropdown-logout:hover {
  background: #fef2f2;
  color: var(--color-error);
}

/* ====================================================
   MY FARM — header dropdown button (houses GDD, Weather, Field Conditions)
==================================================== */
.my-farm-wrap {
  position: relative;
}

.my-farm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-green);
  border: none;
  border-radius: var(--radius-pill);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.my-farm-btn:hover {
  background: var(--color-green-mid);
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.25);
}

.my-farm-btn:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

.my-farm-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 190px;
  z-index: 300;
  overflow: hidden;
}

.my-farm-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.my-farm-dropdown-item:hover {
  background: var(--color-green-pale);
  color: var(--color-green);
}

/* ====================================================
   VIEW FARM PROFILE MODAL — read-only display
==================================================== */
.farm-profile-view {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.75rem 0;
  max-height: 55vh;
  overflow-y: auto;
}

.vfp-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  line-height: 1.4;
}

.vfp-row:last-child {
  border-bottom: none;
}

.vfp-label {
  flex: 0 0 140px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.vfp-value {
  flex: 1;
  color: var(--color-text);
}

/* ====================================================
   CHAT CONTEXT CONTROL ROW
   (above the chat prompt box)
==================================================== */
.chat-context-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.35rem 1.25rem 0.55rem;
}

.chat-header-controls-inner {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* 3-state crop toggle in header */
.header-crop-toggle {
  display: inline-flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 3px;
}

.header-crop-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: none;
  border-radius: 30px;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.header-crop-btn:hover {
  color: var(--color-green);
}

.header-crop-btn.active {
  background: var(--color-green);
  color: var(--color-white);
}

.header-crop-btn[data-crop="soy"].active {
  background: var(--color-soy-gold);
}

.header-crop-btn:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

/* Add Field Data / Use Field Data button */
.add-field-data-btn {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-green-border);
  border-radius: var(--radius-sm);
  color: var(--color-green);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
}

.add-field-data-btn:hover {
  background: var(--color-green-pale);
  border-color: var(--color-green);
  box-shadow: var(--shadow);
}

.add-field-data-btn.active {
  background: var(--color-green);
  border-color: var(--color-green);
  color: var(--color-white);
  box-shadow: var(--shadow);
}

.add-field-data-btn.active:hover {
  background: var(--color-green-mid);
  border-color: var(--color-green-mid);
}

.add-field-data-btn:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

/* Add Local Weather button */
.add-weather-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-surface);
  border: 1.5px solid #90CAF9;
  border-radius: var(--radius-sm);
  color: #1565C0;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
  white-space: nowrap;
}

.add-weather-btn:hover {
  background: #E3F2FD;
  border-color: #1565C0;
  box-shadow: var(--shadow);
}

.add-weather-btn.active {
  background: #1976D2;
  border-color: #1565C0;
  color: var(--color-white);
  box-shadow: var(--shadow);
}

.add-weather-btn.active:hover {
  background: #1565C0;
  border-color: #0D47A1;
}

.add-weather-btn:focus-visible {
  outline: 2px solid #1976D2;
  outline-offset: 2px;
}

/* ====================================================
   CHAT LAYOUT — updated height accounting for header bar
==================================================== */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - var(--chat-topbar-h));
  overflow: hidden;
}

/* ====================================================
   SIDEBAR — refactored sections
==================================================== */
.chat-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

.sidebar-section {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* My Fields section: capped height with its own scroll so Recent Conversations always has room */
.sidebar-section--fields {
  max-height: 220px;
  overflow-y: auto;
}

.sidebar-section--grow {
  flex: 1;
  min-height: 0;
  border-bottom: none;
  overflow-y: auto;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-light);
}

.sidebar-action-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-green);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.65rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.sidebar-action-btn:hover {
  background: var(--color-green-pale);
  border-color: var(--color-green-border);
}

.sidebar-profile-summary {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  word-break: break-word;
}

/* Sidebar lists (fields + conversations) */
.sidebar-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
}

.sidebar-list-empty {
  font-size: 0.8rem;
  color: var(--color-text-light);
  font-style: italic;
  padding: 0.25rem 0;
}

.sidebar-list-item {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: background 0.15s;
}

.sidebar-list-item:hover {
  background: var(--color-bg);
}

.sidebar-list-item.active {
  background: var(--color-green-pale);
}

/* Field item */
.sidebar-field-btn {
  flex: 1;
  background: none;
  border: none;
  text-align: left;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.field-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.field-item-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.sidebar-item-edit-btn {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 0.85rem;
  padding: 0 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}

.sidebar-item-edit-btn:hover {
  color: var(--color-green);
}

/* Conversation item */
.sidebar-conv-btn {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  text-align: left;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-item-delete-btn {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 0.85rem;
  padding: 0 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
}

.sidebar-item-delete-btn:hover {
  color: var(--color-error);
}

.sidebar-item-rename-btn {
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 0.85rem;
  padding: 0 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
}

.sidebar-item-rename-btn:hover {
  color: var(--color-green);
}

.conv-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.conv-preview {
  font-size: 0.75rem;
  color: var(--color-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* New conversation button (pinned at bottom of sidebar) */
.sidebar-new-conv {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

.btn-new-conv {
  display: block;
  width: 100%;
  background: var(--color-green);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, box-shadow 0.2s;
}

.btn-new-conv:hover {
  background: var(--color-green-mid);
  box-shadow: 0 2px 8px rgba(46,125,50,0.25);
}

.btn-new-conv:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

/* ====================================================
   MODAL — tabs for field add/edit
==================================================== */
.modal-card--wide {
  max-width: 760px;
}

.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.25rem;
}

.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.modal-tab:hover {
  color: var(--color-green);
}

.modal-tab.active {
  color: var(--color-green);
  border-bottom-color: var(--color-green);
}

.modal-tab:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

.required-star {
  color: var(--color-error);
}

/* ====================================================
   RESPONSIVE — chat page
==================================================== */
@media (max-width: 640px) {
  .chat-context-controls {
    padding: 0.45rem 0.75rem;
  }
  .chat-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    min-height: calc(100vh - 100px);
  }
  .chat-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    max-height: 40vh;
  }
  .header-crop-btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
  }
  .add-field-data-btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
  }
  .add-weather-btn {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
  }
}

.chat-main {
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  min-height: 0; /* allow flex item to shrink below content size so overflow-y: auto scrolls */
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  gap: 0.75rem;
  max-width: 75%;
  animation: fadeSlideIn 0.2s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.message.user .message-avatar {
  background-color: var(--color-green-pale);
}

.message.assistant .message-avatar {
  background-color: var(--color-green-pale);
}

.message-bubble {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
  background-color: #C8E6C9;
  border-color: #C8E6C9;
  color: #1a1a1a;
}

.message-source {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 0.35rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.source-chip {
  background-color: var(--color-green-pale);
  border: 1px solid var(--color-green-border);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  color: var(--color-green);
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  vertical-align: top;
}

/* Section/page detail line rendered below the source label inside the chip.
 * Shown only when section or page metadata is available (new canonical citations).
 * Legacy {label, url} sources are unaffected. */
.source-chip-detail {
  font-size: 0.63rem;
  color: var(--color-text-muted, var(--color-text-light));
  opacity: 0.85;
  line-height: 1.2;
  margin-top: 0.05rem;
}

.chat-empty-state {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex: 1;
  padding: 2rem 1.25rem;
  color: var(--color-text-muted);
}

.chat-empty-layout {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.35rem;
}

.chat-empty-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  gap: 0.75rem;
}

.chat-empty-wordmark {
  width: min(100%, 160px);
  height: auto;
  display: block;
  padding-left: 30px;
}

.chat-empty-icon {
  width: clamp(162px, 22vw, 198px);
  height: auto;
  object-fit: contain;
  display: block;
  opacity: 0.76;
}

.chat-empty-state h2 {
  font-size: 1.55rem;
  color: var(--color-text);
  margin-bottom: 0;
}

.chat-empty-state p {
  font-size: 1rem;
  max-width: 420px;
  margin: 0;
}

.chat-instructions {
  width: 100%;
  max-width: none;
  margin-top: 0;
  text-align: left;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf7 100%);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 0.95rem 1.1rem;
}

.chat-instructions-lead {
  margin: 0;
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 700;
}

.chat-instructions-steps {
  margin: 0.6rem 0 0;
  padding-left: 1.2rem;
  color: var(--color-text);
}

.chat-instructions-steps li {
  margin: 0 0 0.42rem;
  line-height: 1.45;
  font-size: 0.92rem;
}

.chat-instructions-steps li:last-child {
  margin-bottom: 0;
}

.chat-instructions-tip {
  margin: 0.7rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--color-border);
  color: var(--color-text-muted, #666);
  font-size: 0.85rem;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .chat-empty-state {
    padding: 1.35rem 0.9rem;
  }

  .chat-empty-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chat-empty-copy {
    align-items: center;
    text-align: center;
  }

  .chat-empty-wordmark {
    width: min(100%, 140px);
  }

  .chat-empty-state h2 {
    font-size: 1.3rem;
  }

  .chat-empty-state p {
    font-size: 0.94rem;
    max-width: 500px;
  }

  .chat-instructions {
    padding: 0.85rem 0.85rem;
  }

  .chat-instructions-steps li {
    font-size: 0.89rem;
  }
}

.chat-input-bar {
  border-top: 1px solid var(--color-border);
  padding: 1rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  background-color: var(--color-white);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: none;
}

.chat-input:focus {
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.10);
}

.chat-send-btn {
  background-color: var(--color-green);
  border: none;
  border-radius: var(--radius-pill);
  color: var(--color-white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-send-btn:hover {
  background-color: var(--color-green-mid);
}

.chat-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-disclaimer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 0.1rem 1.5rem;
  background-color: var(--color-white);
}

.chat-disclaimer--secondary {
  padding-bottom: 0.45rem;
}

.chat-beta-limit {
  text-align: center;
  font-size: 0.8rem;
  color: #14532d;
  font-weight: 600;
  padding: 0.45rem 1.5rem 0.2rem;
  background-color: #f0fdf4;
  border-top: 1px solid #dcfce7;
}

.chat-feedback-row {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: 0 1.5rem 0.55rem;
  background-color: var(--color-white);
}

.chat-feedback-row a {
  color: var(--color-green);
  font-weight: 600;
  text-decoration: none;
}

.chat-feedback-row a:hover {
  text-decoration: underline;
}

.chat-feedback-row .help-link-btn:hover {
  text-decoration: underline;
}

/* ---- Debug corner panel (bottom-right fixed, RAG + LLM checkboxes) ---- */
.debug-corner-panel {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.65rem;
  background-color: rgba(255, 251, 235, 0.92);
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.debug-corner-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #92400e;
  cursor: pointer;
  user-select: none;
}

.debug-corner-label input[type="checkbox"] {
  width: 0.85rem;
  height: 0.85rem;
  cursor: pointer;
  accent-color: #d97706;
}

/* ---- Retrieval chunk cards ---- */
.retrieval-chunks-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.retrieval-chunks-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: #92400e;
  background-color: #fef3c7;
  border: 1px solid #fde68a;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.retrieval-chunk-card {
  border: 1px solid #fde68a;
  border-top: none;
  background: var(--color-white);
  padding: 0.65rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
}

.retrieval-chunk-card:last-child {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.retrieval-chunk-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}

.retrieval-chunk-source {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.1rem;
}

.retrieval-chunk-section {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: 0.1rem;
}

.retrieval-chunk-url {
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.retrieval-chunk-url a {
  color: var(--color-sky-blue, #2196f3);
  word-break: break-all;
}

.retrieval-chunk-score {
  font-size: 0.72rem;
  color: var(--color-text-light);
  margin-bottom: 0.2rem;
}

.retrieval-chunk-preview {
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 2px solid #fde68a;
  padding-left: 0.5rem;
  margin-top: 0.3rem;
}

.retrieval-meta {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
  padding: 0.3rem 0.5rem;
  background: #fef9ee;
  border: 1px solid #fde68a;
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* ---- Prompt preview card (retrieval test mode) ---- */
.prompt-preview-card {
  border: 1px solid #c4b5fd;
  border-radius: var(--radius-sm);
  background: var(--color-white);
  overflow: hidden;
  margin-top: 0.5rem;
}

.prompt-preview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #5b21b6;
  background-color: #ede9fe;
  border-bottom: 1px solid #c4b5fd;
  padding: 0.4rem 0.75rem;
}

.prompt-preview-toggle-bar {
  display: flex;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: #f5f3ff;
  border-bottom: 1px solid #ede9fe;
}

.prompt-preview-toggle-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  background: var(--color-white);
  color: #6d28d9;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.prompt-preview-toggle-btn.active {
  background: #7c3aed;
  color: var(--color-white);
  border-color: #7c3aed;
}

.prompt-preview-toggle-btn:hover:not(.active) {
  background: #ede9fe;
}

.prompt-preview-section-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6d28d9;
  background: #f5f3ff;
  border-bottom: 1px solid #ede9fe;
  padding: 0.25rem 0.75rem;
  margin-top: 0;
}

.prompt-preview-pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.6rem 0.75rem;
  margin: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--color-white);
  border-bottom: 1px solid #ede9fe;
}

.prompt-preview-pre:last-child {
  border-bottom: none;
}

.typing-indicator .message-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.9rem 1rem;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--color-text-light);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ====================================================
   FARM PROFILE PAGE
==================================================== */
.profile-page {
  background-color: var(--color-bg);
  min-height: calc(100vh - 60px);
  padding: 3rem 1.5rem;
}

.profile-container {
  max-width: 680px;
  margin: 0 auto;
}

.profile-header {
  margin-bottom: 2.5rem;
}

.profile-header h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3vw, 2rem);
  color: var(--color-text);
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-header p {
  color: var(--color-text-muted);
  font-size: 1rem;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Tile cards with rounded corners and drop shadow */
.form-section {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.form-section-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.field-group .field-hint {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: -0.2rem;
}

.field-group input[type="text"],
.field-group input[type="number"],
.field-group input[type="date"],
.field-group select,
.field-group textarea {
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.10);
}

.field-group textarea {
  min-height: 90px;
  resize: vertical;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.45rem 0.75rem;
  margin-top: 0.35rem;
}

.field-date-input {
  width: 100%;
  min-height: 42px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.profile-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-secondary {
  display: inline-block;
  background-color: transparent;
  color: var(--color-green);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: 1.5px solid var(--color-green-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background-color: var(--color-green-pale);
  border-color: var(--color-green);
  color: var(--color-green);
}

.profile-save-msg {
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 0.25rem;
}

.profile-save-msg.success { color: var(--color-green); }
.profile-save-msg.error   { color: var(--color-error); }

.btn-danger {
  border-color: #fecaca;
  color: var(--color-error);
}

.btn-danger:hover {
  background-color: #fef2f2;
  border-color: var(--color-error);
}

/* ====================================================
   MODAL
==================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 50, 28, 0.35);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.modal-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.modal-field-full {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ====================================================
   FEEDBACK MODAL — select / textarea styles
==================================================== */
#feedback-form select,
#feedback-form textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s;
  resize: vertical;
}

#feedback-form select:focus,
#feedback-form textarea:focus {
  outline: none;
  border-color: var(--color-green);
}

.field-required {
  color: var(--color-error);
}

/* ====================================================
   HELP & SUPPORT MODAL
==================================================== */
.help-faq {
  margin-bottom: 1.5rem;
}

.help-faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 0.1rem 0;
}

.help-faq-item:last-child {
  border-bottom: none;
}

.help-faq-q {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  padding: 0.65rem 0.25rem;
  list-style: none;
  user-select: none;
}

.help-faq-q::-webkit-details-marker { display: none; }

.help-faq-q::before {
  content: '+ ';
  color: var(--color-green);
  font-weight: 700;
}

details[open] .help-faq-q::before {
  content: '− ';
}

.help-faq-a {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding: 0.25rem 0.25rem 0.75rem 1rem;
  line-height: 1.6;
}

.help-link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--color-green);
  cursor: pointer;
  text-decoration: underline;
  display: inline;
}

.help-link-btn:hover {
  color: var(--color-green-mid);
}

.help-contact {
  background: var(--color-green-pale);
  border: 1px solid var(--color-green-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 0.5rem;
}

.help-contact-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.help-contact-text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ====================================================
   RESPONSIVE
==================================================== */
@media (max-width: 640px) {
  .site-header nav {
    gap: 1rem;
  }

  .site-header nav a {
    font-size: 0.8rem;
  }

  .hero {
    padding: 4rem 1rem 3.5rem;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .form-group {
    flex-direction: column;
  }

  .form-group input[type="email"],
  .form-group .btn-primary {
    width: 100%;
  }

  .message {
    max-width: 90%;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .modal-field-grid {
    grid-template-columns: 1fr;
  }
}

/* ====================================================
   CHAT MAIN — top bar (houses the weather dashboard btn)
==================================================== */
.chat-main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

/* ====================================================
   TOPBAR TOOL BUTTONS (Weather / GDD / Field Conditions)
==================================================== */
.topbar-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  letter-spacing: 0.01em;
}

.topbar-tool-btn:hover {
  background: var(--color-green-pale);
  border-color: var(--color-green-border);
  color: var(--color-green);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.20);
}

.topbar-tool-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.topbar-tool-btn:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 3px;
}

/* ====================================================
   WEATHER DASHBOARD MODAL
==================================================== */

/* Override modal-card defaults for a wider layout */
.wd-modal-card {
  max-width: 900px;
  padding: 1.5rem 1.75rem 2rem;
}

/* Header row */
.wd-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.wd-modal-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.wd-location-badge {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 0.2rem 0.75rem;
  white-space: nowrap;
}

.wd-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.wd-refresh-btn {
  background: none;
  border: 1.5px solid var(--color-green-border);
  border-radius: var(--radius-sm);
  color: var(--color-green);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.wd-refresh-btn:hover {
  background: var(--color-green-pale);
  border-color: var(--color-green);
}

.wd-refresh-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.wd-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.wd-close-btn:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.wd-close-btn:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

/* Loading / error states */
.wd-loading {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.wd-error {
  padding: 1rem 1.25rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: var(--color-error);
  font-size: 0.9rem;
}

/* Section title */
.wd-section {
  margin-bottom: 1.75rem;
}

.wd-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-green);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  display: inline-block;
}

/* ---- Field Readiness gauge cards ---- */
.wd-gauges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.wd-gauge-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wd-gauge-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  text-align: center;
}

.wd-gauge-body {
  width: 100%;
}

/* Soil temperature index */
.wd-soil-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.wd-soil-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.wd-soil-status {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.wd-soil-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.wd-soil-range {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
  opacity: 0.6;
}

.wd-soil-range.active {
  opacity: 1;
  font-weight: 700;
  box-shadow: 0 0 0 2px currentColor;
}

.wd-unsafe  { background: #ffcdd2; color: #b71c1c; border-color: #ef9a9a; }
.wd-moderate{ background: #fff9c4; color: #e65100; border-color: #ffe082; }
.wd-safe    { background: #c8e6c9; color: #1b5e20; border-color: #a5d6a7; }

.wd-range-value { font-size: 0.7rem; opacity: 0.9; }

/* GDD tile */
.wd-gdd-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}

.wd-gdd-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--color-green);
}

.wd-gdd-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-align: center;
}

.wd-gdd-sublabel {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

/* Workability tile */
.wd-work-index {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.wd-work-status {
  font-size: 1.35rem;
  font-weight: 700;
}

.wd-work-score {
  font-size: 0.82rem;
  font-weight: 500;
}

.wd-precip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 6px;
}

.wd-precip-table th,
.wd-precip-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.wd-precip-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
}

/* ---- 7-Day Forecast tiles ---- */
.wd-forecast-tiles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.wd-forecast-tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  min-width: 0;
}

.wd-forecast-tile:first-child {
  border: 2px solid var(--color-green);
}

.wd-tile-day {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-green);
}

.wd-tile-date {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.wd-tile-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.wd-tile-temps {
  display: flex;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  flex-wrap: wrap;
  justify-content: center;
}

.wd-tile-high { color: #c62828; }
.wd-tile-low  { color: #1565c0; }

.wd-tile-precip {
  font-size: 0.78rem;
  color: #1565c0;
  font-weight: 500;
}

.wd-tile-wind {
  font-size: 0.75rem;
  color: #546e7a;
}

.wd-tile-gdd {
  font-size: 0.72rem;
  color: var(--color-text);
  font-weight: 500;
}

.wd-tile-gdd-cum {
  font-size: 0.78rem;
  color: #e65100;
  font-weight: 700;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .wd-gauges {
    grid-template-columns: 1fr;
  }

  .wd-forecast-tiles {
    grid-template-columns: repeat(4, 1fr);
  }

  .wd-modal-card {
    padding: 1.25rem;
  }

  .chat-main-topbar {
    flex-wrap: wrap;
  }

  .fc-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .wd-forecast-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ====================================================
   TODAY'S CONDITIONS CARD (Weather modal)
==================================================== */
.wd-today-card {
  display: flex;
  gap: 2rem;
  align-items: center;
  background: var(--color-green-pale);
  border: 1px solid var(--color-green-border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  flex-wrap: wrap;
}

.wd-today-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
}

.wd-today-emoji {
  font-size: 2.8rem;
  line-height: 1;
}

.wd-today-temp {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-green);
  line-height: 1.1;
}

.wd-today-desc {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.wd-today-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1.5rem;
}

.wd-today-detail {
  font-size: 0.88rem;
  color: var(--color-text);
  font-weight: 500;
}

/* ====================================================
   GDD MODAL STYLES
==================================================== */

/* ---- 4-card summary grid ---- */
.gdd-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.gdd-summary-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-green-border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.gdd-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.gdd-card-val {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-green);
  line-height: 1.1;
}

.gdd-card-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Custom-date card: picker row */
.gdd-card-custom {
  gap: 6px;
}

.gdd-card-picker-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
  flex-wrap: wrap;
}

.gdd-go-btn {
  background: var(--color-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  white-space: nowrap;
}

.gdd-go-btn:hover {
  background: var(--color-green-mid);
}

/* ---- date input (reused in custom card) ---- */
.gdd-start-input {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.5rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--color-text);
  background: var(--color-surface);
}

.gdd-start-input:focus {
  outline: 2px solid var(--color-green);
  outline-offset: 2px;
}

/* ---- GDD color badges ---- */
.gdd-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 3.5rem;
  text-align: center;
}

.gdd-color-high {
  background: #1b5e20;
  color: #fff;
}

.gdd-color-mid {
  background: #81c784;
  color: #1a2a1a;
}

.gdd-color-low {
  background: #fdd835;
  color: #3a3000;
}

/* ---- Forecast + history table ---- */
.gdd-forecast-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.gdd-forecast-table th,
.gdd-forecast-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.gdd-forecast-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Prior-3-days rows: subtle grey tint */
.gdd-hist-row td {
  background: #f5f5f5;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Separator between history and forecast */
.gdd-sep-row td {
  background: var(--color-green-pale);
  color: var(--color-green);
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-bottom: 2px solid var(--color-green-border);
}

/* Today row highlight */
.gdd-today-row td {
  background: var(--color-green-pale);
  font-weight: 600;
}

/* keep older class names in case anything still references them */
.gdd-day-val {
  font-weight: 600;
  color: var(--color-green);
}

.gdd-cum-val {
  font-weight: 700;
  color: #e65100;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .gdd-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* ====================================================
   FIELD CONDITIONS MODAL STYLES
==================================================== */
.fc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.fc-section {
  margin-bottom: 0;
}

.fc-index-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 0;
}

.fc-index-status {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.fc-index-score {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.fc-index-factors {
  font-size: 0.8rem;
  color: var(--color-text);
  padding-left: 1.1rem;
  margin-top: 4px;
}

.fc-index-factors li {
  margin-bottom: 2px;
}

/* Spray window */
.spray-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.spray-day-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--color-green);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.spray-day-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.spray-status {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.spray-reasons {
  font-size: 0.78rem;
  color: var(--color-text);
  padding-left: 1rem;
  margin: 0;
}

.spray-reasons li {
  margin-bottom: 2px;
}

.spray-ok {
  font-size: 0.82rem;
  color: #1b5e20;
  font-weight: 500;
  margin: 0;
}

@media (max-width: 600px) {
  .spray-cards {
    grid-template-columns: 1fr;
  }
}

/* ====================================================
   ASSISTANT BUBBLE MARKDOWN RENDERING
==================================================== */
.message.assistant .message-bubble p {
  margin: 0 0 0.6em;
}
.message.assistant .message-bubble p:last-child {
  margin-bottom: 0;
}

.message.assistant .message-bubble h1,
.message.assistant .message-bubble h2,
.message.assistant .message-bubble h3,
.message.assistant .message-bubble h4,
.message.assistant .message-bubble h5,
.message.assistant .message-bubble h6 {
  font-weight: 600;
  line-height: 1.3;
  margin: 0.8em 0 0.3em;
  color: var(--color-text);
}
.message.assistant .message-bubble h1 { font-size: 1.15rem; }
.message.assistant .message-bubble h2 { font-size: 1.05rem; }
.message.assistant .message-bubble h3,
.message.assistant .message-bubble h4,
.message.assistant .message-bubble h5,
.message.assistant .message-bubble h6 { font-size: 0.97rem; }

.message.assistant .message-bubble ul,
.message.assistant .message-bubble ol {
  margin: 0.4em 0 0.6em 1.4em;
  padding: 0;
}
.message.assistant .message-bubble li {
  margin-bottom: 0.25em;
  line-height: 1.55;
}

.message.assistant .message-bubble strong {
  font-weight: 600;
}
.message.assistant .message-bubble em {
  font-style: italic;
}

.message.assistant .message-bubble a {
  color: var(--color-green);
  text-decoration: underline;
  word-break: break-word;
}
.message.assistant .message-bubble a:hover {
  opacity: 0.8;
}

.message.assistant .message-bubble code {
  background-color: var(--color-green-pale);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  font-size: 0.88em;
  font-family: monospace;
}

.message.assistant .message-bubble pre {
  background-color: var(--color-green-pale);
  border-radius: var(--radius);
  padding: 0.75em 1em;
  overflow-x: auto;
  font-size: 0.88em;
  margin: 0.5em 0;
}
.message.assistant .message-bubble pre code {
  background: none;
  padding: 0;
}

/* =============================================================
   Pesticide Labels Modal  (#pesticide-labels-modal)
   Follows the .wd-modal-overlay / .wd-modal-card pattern used
   by the Weather, GDD, and Field Conditions popups.
   ============================================================= */

/* Override max-width for the wider split-pane layout */
.pl-modal-card {
  max-width: 1100px;
  padding: 1.5rem 1.75rem 1.25rem;
  width: calc(100vw - 2rem);
}

/* Two-column body: sidebar (search + results) | viewer (PDF) */
.pl-body {
  display: flex;
  gap: 1.25rem;
  min-height: 520px;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */

.pl-sidebar {
  display: flex;
  flex-direction: column;
  width: 300px;
  flex-shrink: 0;
  overflow: hidden;
}

/* ── Search form ─────────────────────────────────────────── */

.pl-search-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pl-search-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0 0 0.25rem;
  line-height: 1.45;
}

.pl-search-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  box-sizing: border-box;
}

.pl-search-input:focus {
  outline: none;
  border-color: var(--color-green);
  box-shadow: 0 0 0 2px var(--color-green-pale);
}

.pl-search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pl-mode-select {
  flex: 1;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

.pl-search-btn {
  white-space: nowrap;
  font-size: 0.87rem;
  padding: 0.45rem 0.9rem;
}

/* ── Results list ────────────────────────────────────────── */

.pl-results-area {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.pl-message {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

.pl-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pl-result-item {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.pl-result-item:last-child {
  border-bottom: none;
}

.pl-result-item--selected {
  background: var(--color-green-pale);
}

.pl-result-item--unsupported {
  opacity: 0.6;
}

.pl-result-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.pl-result-company {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.pl-result-footer {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.pl-result-regno {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-family: monospace;
}

.pl-result-status {
  font-size: 0.72rem;
  background: var(--color-green-pale);
  color: var(--color-green);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.55rem;
}

.pl-view-btn {
  margin-top: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-green);
  background: transparent;
  color: var(--color-green);
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s, color 0.15s;
}

.pl-view-btn:hover:not([disabled]) {
  background: var(--color-green);
  color: #fff;
}

.pl-view-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.pl-view-btn--unsupported {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}

.pl-unsupported-note {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin: 0.15rem 0 0;
  line-height: 1.35;
}

/* ── PDF Viewer ──────────────────────────────────────────── */

.pl-viewer-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
}

.pl-viewer-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-align: center;
}

.pl-viewer-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pl-viewer-title {
  font-size: 0.97rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
  line-height: 1.3;
}

.pl-viewer-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.pl-fallback-notice {
  font-size: 0.78rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  margin: 0.2rem 0 0;
}

.pl-version-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.pl-version-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pl-version-select {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}

.pl-external-link {
  font-size: 0.78rem;
  color: var(--color-green);
  text-decoration: underline;
  align-self: flex-start;
}

.pl-viewer-frame {
  flex: 1;
  border: none;
  width: 100%;
  min-height: 400px;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 700px) {
  .pl-modal-card {
    padding: 1rem 1rem 1rem;
  }

  .pl-body {
    flex-direction: column;
    min-height: unset;
  }

  .pl-sidebar {
    width: 100%;
  }

  .pl-results-area {
    max-height: 240px;
  }

  .pl-viewer-area {
    min-height: 320px;
  }

  .pl-viewer-frame {
    min-height: 280px;
  }
}

/* ---- Mobile Warning Popup ---- */
.mobile-warning-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.55);
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.mobile-warning-overlay.is-visible {
  display: flex;
}

.mobile-warning-card {
  background: var(--color-surface, #ffffff);
  border-radius: var(--radius, 18px);
  box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.08));
  border: 1px solid var(--color-border, #E9ECEF);
  padding: 2rem 1.75rem;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.mobile-warning-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.mobile-warning-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text, #1a1a1a);
  margin-bottom: 0.75rem;
}

.mobile-warning-card p {
  font-size: 0.92rem;
  color: var(--color-text-muted, #6B7280);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.mobile-warning-btn {
  display: inline-block;
  padding: 0.65rem 1.75rem;
  background: var(--color-green, #2E7D32);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill, 50px);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mobile-warning-btn:hover {
  background: var(--color-green-mid, #4CAF50);
  transform: translateY(-1px);
}
