:root {
  --primary:       #E84432;
  --primary-hover: #C7321F;
  --primary-light: #F06855;
  --accent:        #FFB8A8;
  --bg:            #FDF6F5;
  --surface:       #ffffff;
  --border:        #EDD9D5;
  --text:          #1A1209;
  --text-muted:    #7A5550;
  --danger:        #B91C1C;
  --warning:       #D97706;
  --radius:        10px;
  --shadow:        0 2px 10px rgba(232,68,50,0.08);
  --nav-h:         58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  height: var(--nav-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(200,50,30,0.3);
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nav-brand img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 3px;
}

.nav-brand span { opacity: 0.96; }

.nav-links { display: flex; gap: 4px; }

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover  { background: rgba(255,255,255,0.18); color: #fff; }
.nav-links a.active { background: rgba(255,255,255,0.25); color: #fff; }

/* ── Layout ───────────────────────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  width: 252px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 14px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar-section:last-child { border-bottom: none; margin-bottom: 0; }

.sidebar-section label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.sidebar-section select,
.sidebar-section input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.sidebar-section select:focus,
.sidebar-section input:focus { border-color: var(--primary-light); }

.coord-row { display: flex; gap: 7px; }
.coord-row input { flex: 1; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover    { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--accent); cursor: default; }

.btn-secondary {
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

/* ── Chat ─────────────────────────────────────────────── */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome {
  text-align: center;
  color: var(--text-muted);
  margin: auto;
  padding: 40px 20px;
}
.welcome img  { width: 80px; height: 80px; object-fit: contain; margin-bottom: 20px; }
.welcome h2   { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.welcome p    { font-size: 14px; line-height: 1.7; max-width: 340px; }

.message { display: flex; flex-direction: column; max-width: 68%; }
.message.user { align-self: flex-end; align-items: flex-end; margin-right: 8px; }
.message.bot  { align-self: flex-start; align-items: flex-start; margin-left: 4px; }

.bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.user .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.message.bot .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow);
}

.message-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.sources {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.source-chip {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  color: var(--text-muted);
}

.alert-box {
  margin-top: 8px;
  background: #FFF7ED;
  border: 1px solid var(--warning);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  color: #7C2D12;
}
.alert-box.critical {
  background: #FEF2F2;
  border-color: var(--danger);
  color: #7F1D1D;
}

.validity-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 20px;
  margin-left: 6px;
}
.validity-high    { background: #DCFCE7; color: #166534; }
.validity-medium  { background: #FEF9C3; color: #854D0E; }
.validity-low     { background: #FFEDD5; color: #7C2D12; }
.validity-poor, .validity-no_match { background: #FEE2E2; color: #7F1D1D; }

/* ── Chat input ───────────────────────────────────────── */
.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14.5px;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s;
  max-height: 120px;
}
.chat-input-row textarea:focus { border-color: var(--primary-light); }
.chat-input-row .btn-primary { height: 42px; align-self: flex-end; }

/* ── Spinner ──────────────────────────────────────────── */
.typing { display: flex; gap: 5px; padding: 14px 15px; }
.dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }

/* ── Logs page ────────────────────────────────────────── */
.logs-page {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  box-shadow: var(--shadow);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.filter-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.filter-field select,
.filter-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: var(--bg);
  outline: none;
}
.filter-field select:focus,
.filter-field input:focus { border-color: var(--primary-light); }

.log-stats {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
  align-self: flex-end;
}

.log-list { display: flex; flex-direction: column; gap: 10px; }

.log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.log-card-header:hover { background: var(--bg); }

.log-time    { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.log-crop    { font-size: 13px; font-weight: 600; flex: 1; }
.log-channel {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--text-muted);
}
.log-chevron { color: var(--text-muted); font-size: 12px; transition: transform 0.2s; }
.log-card.open .log-chevron { transform: rotate(90deg); }

.log-card-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}
.log-card.open .log-card-body { display: block; }

.log-qa   { margin: 10px 0; }
.log-q    { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.log-a    { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.log-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.log-meta-row span { display: flex; align-items: center; gap: 3px; }

.no-logs {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 14px;
}

/* ── Farmer sidebar ───────────────────────────────────── */
.farmer-sidebar {
  width: 290px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.farmer-sidebar .sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  margin: 0;
  gap: 0;
}

.farmer-sidebar .sidebar-section label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.farmer-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 10px;
  font-family: inherit;
}

.farmer-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232,68,50,0.1);
}

.farmer-search-btn {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.farmer-search-btn:hover    { background: var(--primary-hover); }
.farmer-search-btn:disabled { background: var(--accent); cursor: default; }

.fcard-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 3px;
}

.fcard-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.fcard-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.fcard-stat {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fcard-stat span {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.fcard-stat small {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.fcard-row {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.5;
}

.fcard-svc {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.fcard-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.fcard-hist-row {
  display: grid;
  grid-template-columns: 82px 1fr 1fr 36px;
  gap: 4px;
  font-size: 11px;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--bg);
}

.fcard-hist-date { color: var(--text-muted); }
.fcard-hist-crop { color: var(--primary); }
.fcard-hist-ac   { color: var(--text-muted); text-align: right; }

/* ── Farmer page ──────────────────────────────────────── */
.farmer-page {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.farmer-profile {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.farmer-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.farmer-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.farmer-meta {
  font-size: 14px;
  color: var(--text-muted);
}

.farmer-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  word-break: break-word;
}

.stat-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.farmer-svc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.svc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
}

.svc-last { border-left-color: var(--text-muted); }
.svc-next { border-left-color: var(--primary); }

.svc-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.svc-val {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.farmer-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.summary-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.summary-text {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text);
}

.farmer-history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.history-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.history-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: var(--bg); }

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.status-completed { background: #DCFCE7; color: #166534; }
.status-active    { background: #FEF9C3; color: #854D0E; }
.status-pending   { background: #FFEDD5; color: #7C2D12; }
.status-new       { background: #EFF6FF; color: #1E40AF; }
.status-unknown   { background: var(--bg); color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 700px) {
  body { overflow: auto; }
  .layout { flex-direction: column; overflow: visible; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 12px; }
  .chat-container { height: calc(100vh - var(--nav-h) - 200px); }
  .message { max-width: 90%; }
  .filter-bar { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════
   UNIFIED ADVISORY UI — new classes below
   ═══════════════════════════════════════════════════════ */

.hidden { display: none !important; }

/* ── Steps ────────────────────────────────────────────── */
.step {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── Step 0: Track selection ──────────────────────────── */
.track-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 20px;
  gap: 16px;
  background: var(--bg);
}

.hero-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.hero-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
}

.track-cards {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.track-card {
  width: 260px;
  padding: 28px 22px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-family: inherit;
}

.track-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 24px rgba(232,68,50,0.15);
  transform: translateY(-2px);
}

.track-card-icon {
  width: 48px;
  height: 48px;
  color: var(--primary);
}

.track-card-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--primary);
}

.track-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.track-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ── Step 1: Layout ───────────────────────────────────── */
.step-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.step-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.map-panel {
  flex: 1;
  min-height: 0;
}

/* ── Back button ──────────────────────────────────────── */
.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}
.back-btn:hover { background: var(--bg); color: var(--text); }

/* ── Step titles ──────────────────────────────────────── */
.step-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.step-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.step-error {
  background: #FEF2F2;
  border: 1px solid var(--danger);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--danger);
}

/* ── Field groups ─────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.field-group input[type="number"],
.field-group input[type="text"],
.field-group select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.field-group input:focus, .field-group select:focus {
  border-color: var(--primary-light);
}

.full-width { width: 100%; }

/* ── Farmer card compact (step 1) ─────────────────────── */
.farmer-card-compact {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fcc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.fcc-meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.fcc-service {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

.fcc-cta {
  font-size: 12px;
  color: var(--primary);
  line-height: 1.45;
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--surface-2, #f4f6f8);
  border-radius: 6px;
  border-left: 3px solid var(--primary);
}

/* ── Place name search ────────────────────────────────── */
.place-search-row {
  display: flex;
  gap: 6px;
}

.place-search-row input {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.place-search-row input:focus { border-color: var(--primary-light); }
.place-search-row input:disabled { opacity: 0.6; }

.place-btn {
  width: auto !important;
  padding: 9px 14px !important;
  flex-shrink: 0;
}

.place-results {
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  max-height: 200px;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.place-result-item {
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.place-result-item:last-child { border-bottom: none; }
.place-result-item:hover { background: var(--bg); color: var(--primary); }

.place-loading,
.place-no-result {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Dashboard ────────────────────────────────────────── */
.dash-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.dash-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.region-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-header-right select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

/* ── KPI strip ────────────────────────────────────────── */
.kpi-strip {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.kpi-card {
  min-width: 86px;
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
}

.kpi-unit {
  font-size: 10px;
  color: var(--text-muted);
}

.kpi-card.good { border-color: #86efac; }
.kpi-card.good .kpi-value { color: #16a34a; }
.kpi-card.warn { border-color: #fcd34d; }
.kpi-card.warn .kpi-value { color: var(--warning); }
.kpi-card.bad  { border-color: #fca5a5; }
.kpi-card.bad  .kpi-value { color: var(--danger); }

/* ── Dashboard body ───────────────────────────────────── */
.dash-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.dash-map {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.dash-advisory {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Farmer banner ────────────────────────────────────── */
.farmer-banner {
  background: #FFF7ED;
  border-bottom: 1px solid #FCD34D;
  flex-shrink: 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.fb-head-info { flex: 1; min-width: 0; }

.fb-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.fb-services {
  display: flex;
  gap: 8px;
}

.fb-svc-col {
  flex: 1;
  background: rgba(255,255,255,0.75);
  border: 1px solid #FCD34D;
  border-radius: 7px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.fb-svc-lbl {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #92400E;
  margin-bottom: 1px;
}

.fb-svc-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.fb-svc-type {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-svc-none {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.stage-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Advisory panels ──────────────────────────────────── */
.advisory-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.advisory-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.advisory-toolbar select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.welcome-inner {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: auto;
  padding: 20px;
}

/* ── Coverage / not-covered panel ─────────────────────── */
.coverage-notice {
  background: #FEF3C7;
  border: 1px solid #D97706;
  border-radius: 10px;
  margin: 14px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #7C2D12;
  line-height: 1.5;
}

.coverage-sub {
  font-weight: 400;
  font-size: 12px;
  display: block;
  margin-top: 3px;
}

.conditions-summary {
  padding: 0 14px 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.cond-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cond-row {
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.general-rec {
  margin: 0 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

/* ── Responsive additions ─────────────────────────────── */
@media (max-width: 900px) {
  .dash-map { width: 240px; }
  .step-sidebar { width: 240px; }
  .kpi-card { min-width: 70px; }
}

@media (max-width: 640px) {
  .dash-body { flex-direction: column; }
  .dash-map { width: 100%; height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
  .step-layout { flex-direction: column; }
  .step-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .map-panel { height: 300px; }
  .track-card { width: 90%; }
  .fb-services { flex-direction: column; }
  .ctx-cond-grid { grid-template-columns: 1fr; }
}

/* ── Markdown-rendered advisory bubbles ───────────────── */
.adv-bubble { white-space: normal; }

.adv-list {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.adv-list li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.adv-list li:last-child { margin-bottom: 0; }

/* ── Collapsible field conditions block ───────────────── */
.cond-detail {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.cond-summary {
  padding: 6px 10px;
  background: #F1F5F9;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  list-style: none;
  user-select: none;
}
.cond-summary::-webkit-details-marker { display: none; }
.cond-summary::before { content: "+ "; }
.cond-detail[open] .cond-summary::before { content: "- "; }
.cond-body {
  padding: 8px 12px;
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
  background: #FAFAFA;
}

/* ── Baseline wizard ──────────────────────────────────── */
.wizard-q-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.wizard-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wizard-choice-btn {
  background: #fff;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.wizard-choice-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}
.wizard-choice-btn.selected {
  background: var(--primary);
  color: #fff;
}
.wizard-choice-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ── Read more / collapse ─────────────────────────────── */
.adv-more.hidden { display: none; }
.read-more-btn {
  display: inline-block;
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.read-more-btn:hover { color: var(--primary-hover); }

/* ── Field context card (farmer track chat brief) ─────── */
.context-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ctx-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
}

.ctx-section-hd {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary);
  margin-top: 2px;
}

.ctx-stage {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctx-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
}

.ctx-cond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.ctx-cond-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.ctx-cond-row:nth-last-child(-n+2) { border-bottom: none; }

.ctx-cond-lbl { color: var(--text-muted); }

.ctx-cond-val { font-weight: 600; color: var(--text); }

.ctx-cond-row.good .ctx-cond-val { color: #16a34a; }
.ctx-cond-row.warn .ctx-cond-val { color: var(--warning); }
.ctx-cond-row.bad  .ctx-cond-val { color: var(--danger); }

.ctx-footer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

/* ═══════════════════════════════════════════════════════
   CONSOLIDATED FARMER CARD
   ═══════════════════════════════════════════════════════ */

.farmer-card {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* Header row */
.fc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px 8px;
  background: #FFF7ED;
  border-bottom: 1px solid #FDE68A;
}

.fc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.fc-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Three summary columns */
.fc-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.fc-col {
  padding: 7px 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.fc-col:last-child { border-right: none; }

.fc-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.fc-col-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
}

.fc-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 11px;
  font-family: inherit;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  flex-shrink: 0;
}
.fc-link:hover { color: var(--primary-hover); }

.fc-col-summary { min-height: 38px; }

.fc-metric {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-metric.good  { color: #16a34a; }
.fc-metric.warn  { color: var(--warning); }
.fc-metric.bad   { color: var(--danger); }
.fc-metric.muted { color: var(--text-muted); font-style: italic; }

/* Shared detail panel */
.fc-detail-panel {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 14px 10px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fc-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.fc-detail-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-muted);
}

.fc-detail-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Detail data table */
.fc-detail-table {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.fc-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 9px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.fc-detail-row:last-child { border-bottom: none; }
.fc-detail-row:hover { background: rgba(0,0,0,0.02); }

.fc-detail-lbl { color: var(--text-muted); }
.fc-detail-val { font-weight: 600; color: var(--text); text-align: right; max-width: 60%; }

.fc-detail-row.good .fc-detail-val { color: #16a34a; }
.fc-detail-row.warn .fc-detail-val { color: var(--warning); }
.fc-detail-row.bad  .fc-detail-val { color: var(--danger); }

.fc-detail-source {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.fc-no-data {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* 7-day forecast */
.fc-forecast-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 4px;
}

.fc-forecast-table {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.fc-fc-row {
  display: grid;
  grid-template-columns: 86px 76px 1fr;
  gap: 4px;
  padding: 4px 9px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.fc-fc-row:last-child { border-bottom: none; }
.fc-fc-row:hover { background: rgba(0,0,0,0.02); }

.fc-fc-date { color: var(--text-muted); }
.fc-fc-temp { color: var(--text); }
.fc-fc-rain { font-weight: 600; color: var(--text); }
.fc-fc-rain.good  { color: #16a34a; }
.fc-fc-rain.muted { color: var(--text-muted); }

/* Service history table */
.fc-hist-table {
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
}

.fc-hist-head {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 44px 74px;
  gap: 4px;
  padding: 4px 9px;
  background: var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.fc-hist-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 44px 74px;
  gap: 4px;
  padding: 4px 9px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.fc-hist-row:last-child { border-bottom: none; }
.fc-hist-row:hover { background: var(--bg); }

/* Next step banner */
.fc-next-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 14px;
  background: #FFFBEB;
  border-top: 1px solid #FDE68A;
}

.fc-next-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: #92400E;
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.fc-next-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

/* Next step Details button */
.fc-ns-details-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 11px;
  padding: 2px 0;
  white-space: nowrap;
}

/* Next step detail panel content */
.ns-action {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ns-action-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #92400E;
}

.ns-action-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.ns-section-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 4px;
}

.ns-guide-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ns-guide-a {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.ns-guide-a:hover { text-decoration: underline; }
.ns-guide-a::before { content: "PDF  "; font-size: 11px; opacity: 0.7; }

.ns-guide-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ns-tip {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 2px;
}

.ns-advisory-response {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
.ns-advisory-response ol.adv-list,
.ns-advisory-response ul.adv-list {
  margin: 4px 0 4px 16px;
  padding: 0;
}
.ns-advisory-response li { margin-bottom: 3px; }
.ns-advisory-response strong { color: var(--text); }

.ns-steps-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 4px;
}

.ns-step-item {
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  border-radius: 4px;
  line-height: 1.45;
}

.ns-guide-sections {
  margin: 6px 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ns-guide-section-item {
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 7px;
  color: var(--text-muted);
}

.ns-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.ns-chip {
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 14px;
  padding: 4px 10px;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: background 0.15s;
}
.ns-chip:hover {
  background: var(--primary);
  color: #fff;
}

/* Responsive */
@media (max-width: 640px) {
  .fc-columns { grid-template-columns: 1fr; }
  .fc-col { border-right: none; border-bottom: 1px solid var(--border); }
  .fc-col:last-child { border-bottom: none; }
  .fc-hist-head,
  .fc-hist-row { grid-template-columns: 74px 1fr 1fr 36px; }
  .fc-hist-head > span:nth-child(4),
  .fc-hist-row > span:nth-child(4) { display: none; }
}
