/* ============================================================
  AMFE – Farmers Portal | style.css
  Pixel-perfect match to UI mockups
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --green-dark:  #1e4d3a; /* matches admin's --primary so the two roles share one brand green */
  --green-mid:   #40916c;
  --green-light: #b7e4c7;
  --green-pale:  #f0faf4;
  --green-badge: #d8f3e3;
  --sidebar-bg:  #ffffff;
  --sidebar-w:   210px;
  --body-bg:     #f7f8f9;
  --card-bg:     #ffffff;
  --border:      #e8eaed;
  --text:        #1a1a2e;
  --muted:       #6b7280;
  --red:         #e63946;
  --primary:     #1e4d3a; /* alias so role-shell.css mobile top-bar uses brand green */
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; font-family: 'DM Sans', sans-serif; background: var(--body-bg); color: var(--text); font-size: 14px; }

/* ---------- Layout ---------- */
#wrapper { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR — copied from Admin styles for consistent typography
   ============================================================ */
/* Support both id=#sidebar and .sidebar markup */
#sidebar, .sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand, #sidebar .sidebar-brand { padding: 20px 18px 12px; border-bottom: 1px solid var(--border); }
.sidebar-brand .brand-name, #sidebar .brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--green-dark);
  line-height: 1;
  letter-spacing: -0.5px;
}
.sidebar-brand .brand-sub, #sidebar .brand-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sidebar-brand .brand-user, #sidebar .brand-user { font-size: 0.9rem; font-weight: 600; color: #333; margin-top: 10px; }

.sidebar-nav, #sidebar .sidebar-nav {
  flex: 1; padding: 10px 0; list-style: none; overflow-y: auto;
}

/* Apply admin-like nav link sizing and spacing while remaining compatible with existing markup */
.sidebar-nav .nav-item .nav-link,
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; border-radius: 0;
  color: var(--text); font-size: 13.5px; font-weight: 400;
  text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.sidebar-nav .nav-item .nav-link i,
.sidebar-nav a i { font-size: 16px; width: 20px; text-align: center; color: var(--muted); flex-shrink: 0; }
.sidebar-nav .nav-item .nav-link:hover,
.sidebar-nav a:hover { background: var(--green-pale); color: var(--green-dark); }
.sidebar-nav .nav-item .nav-link:hover i,
.sidebar-nav a:hover i { color: var(--green-dark); }
.sidebar-nav .nav-item .nav-link.active,
.sidebar-nav a.active { background: var(--green-dark); color: #fff; font-weight: 500; }
.sidebar-nav .nav-item .nav-link.active i,
.sidebar-nav a.active i { color: #fff; }

.sidebar-footer, #sidebar .sidebar-footer { padding: 12px 18px; border-top: 1px solid var(--border); }
.sidebar-footer .nav-link,
.sidebar-footer .logout-link { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; font-weight: 600; text-decoration: none; padding: 6px 0 6px 19px; background: none; border: none; width: 100%; text-align: left; font-family: inherit; cursor: pointer; }
.sidebar-footer .nav-link:hover,
.sidebar-footer .logout-link:hover { color: var(--green-dark); }

/* Language switch styles live in global.css (loaded on every page).
   Sidebar spacing tweak only: */
.sidebar-footer .lang-switch-sidebar { margin-bottom: 10px; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main-content { flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; margin-left: var(--sidebar-w); }
main { flex: 1; padding: 28px 26px; }

/* Page title */
.page-title { font-family: 'DM Serif Display', serif; font-size: 28px; font-weight: 400; color: var(--text); margin-bottom: 2px; }
.page-sub   { font-size: 0.82rem; color: var(--muted); margin-bottom: 22px; }
/* Settings and Activity Log render a bare .page-title with no .page-sub or
   header wrapper (.prod-header, etc.) after it, so they're left with only
   the title's own 2px margin-bottom before the notification bell's row
   hands off to the page content. Matches Admin's own .page-title
   margin-bottom (admin.css) for the same heading-to-content gap.
   Scoped under .role-farmer (not a bare .page-title-spaced) because
   entrepreneur.css loads after this file and has its own unscoped
   .page-title with equal specificity — an unscoped rule here would lose
   that tie on source order and get silently overridden back to 2px. */
.role-farmer .page-title-spaced { margin-bottom: 20px; }

/* The same 20px on phones and tablets. There, .page-title is pulled out of
   flow into the fixed top bar (role-shell.css), so the rule above has
   nothing left to push against and the pages that open on a bare title —
   Analytics, Settings, Activity Log — dropped their first card straight
   under the bar. The shell leaves a flat 10px there at every breakpoint
   (#main-content padding-top 70px against a 60px bar, and 58px against a
   48px bar in short landscape), so 10px inside <main> lands on 20px in
   both. Written as id + role class with !important because it has to
   out-specify role-shell.css's own `main { padding: 0 !important }`. */
@media screen and (max-width: 991px) {
  .role-farmer #main-content > main { padding-top: 10px !important; }

  /* The profile wrapper supplies the shared 20px gap on compact layouts.
     Prevent its nested title from adding a second gap on tablets. */
  .profile-header .page-title { margin-bottom: 0 !important; }
}

/* Production is the one page that would overshoot: at this width its
   header button moves into the floating .mobile-add-fab and .page-title is
   in the fixed bar, so .prod-header is an empty box whose 12px (further
   down this file) would stack on the gap above. Between 577px and 991px
   the button is still in the header, so it stays a real row there. */
@media screen and (max-width: 576.98px) {
  .role-farmer .prod-header { margin-bottom: 0; }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  /* padding lives in the .role-farmer-scoped .card rule further down —
     an unscoped value here loses to entrepreneur.css's later-loaded,
     equal-specificity .card rule on every farmer page. */
}
.card-title {
  font-size: 11px; font-weight: 500; color: var(--muted);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.card-value { font-size: 20px; font-weight: 600; color: var(--text); line-height: 1.2; }
.card-icon  { font-size: 1.4rem; color: var(--green-light); }

/* ============================================================
   DASHBOARD
   ============================================================ */

/* Stat mini-cards row */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }

/* Stat card: horizontal layout (text left, icon right).
   flex-direction: row is required to override Bootstrap .card's column direction. */
.stat-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
  color: var(--green-dark);
}
/* Welcome greeting — content heading on desktop, below fixed bar on mobile */
.dash-welcome {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 2px;
}

/* On desktop, hide the "Dashboard" page-title label; dash-welcome serves as heading */
@media (min-width: 992px) {
  .dash-page-title { display: none; }
}

/* Activity + Insights side-by-side. Deliberately NOT stretched to fill the
   viewport: these cards size to their content, so a light-content dashboard
   ends early rather than rendering tall, mostly-empty card interiors. */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.section-label {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
}
.section-label i { color: var(--green-dark); }

/* Activity list */
.activity-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--body-bg);
}
.activity-row:last-child { border-bottom: none; padding-bottom: 0; }
.activity-row > div { min-width: 0; flex: 1; }
.activity-main { font-size: 0.82rem; font-weight: 600; color: var(--text); word-break: break-word; }
.activity-date { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }

.tag { font-size: 0.7rem; font-weight: 700; border-radius: 20px; padding: 2px 10px; white-space: nowrap; }
.tag-fresh { background: var(--green-badge); color: var(--green-dark); }
.tag-dried { background: #e8eaed; color: #555; }

/* Performance insights */
.insight-block { margin-bottom: 10px; }
.insight-label { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.insight-val   { font-size: 1rem; font-weight: 800; }
.insight-sub   { font-size: 0.74rem; color: var(--muted); }

/* Base .tip-box sizing/copy fallback; the .role-farmer rules below (its
   only real consumer) replace the surface treatment entirely. */
.tip-box {
  background: var(--green-badge);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.78rem; color: #333; margin-top: 8px;
}
.tip-box strong { color: var(--green-dark); }

/* ============================================================
   DASHBOARD — refined (scoped to .role-farmer: this file loads
   before entrepreneur.css / admin.css, which redeclare several of
   these same class names unscoped and would otherwise win the
   cascade on every page, farmer included — see .btn-green above
   for the same fix already established in this file)
   ============================================================ */

/* Page header */
.role-farmer .dash-welcome { font-size: 26px; letter-spacing: -0.3px; }
.role-farmer .dash-welcome + .page-sub { margin-bottom: 30px; }
/* The subtitle used to sit between the greeting and the stat grid and
   carried the gap (the rule above). With it removed, .dash-welcome's own
   2px bottom margin left the cards crowding the greeting — so the heading
   carries the spacing itself now. :not() keeps the old value wherever a
   .page-sub does still follow. */
.role-farmer .dash-welcome:not(:has(+ .page-sub)) { margin-bottom: 26px; }

/* Cards — shared radius, slightly tighter than the default 12px.
   Padding is scoped here too: entrepreneur.css's unscoped .card loads
   after this file with equal specificity, so an unscoped padding here
   would silently lose to it on every farmer page. */
.role-farmer .card { border-radius: 10px; padding: 22px 24px; }

/* Stat cards — padding, title/value gap and value size matched to admin's
   .stat-card/.stat-label/.stat-value (admin.css) so the two roles' stat
   rows read as the same size. */
.role-farmer .stat-grid { gap: 16px; margin-bottom: 24px; }
.role-farmer .stat-card { padding: 30px 20px; }
.role-farmer .stat-card .card-title { font-weight: 600; letter-spacing: 0.6px; margin-bottom: 2px; }
.role-farmer .card-value { font-size: 20px; font-weight: 600; letter-spacing: normal; }
.role-farmer .stat-icon { width: 44px; height: 44px; font-size: 18px; }

/* Recent Activity + Performance Insights — elevated like admin's .amfe-card,
   since farmer's shared .card class stays flat everywhere else (Income,
   Production, Profile). Padding/radius/gap matched to admin's .amfe-card
   and three-column row (g-3) too, scoped to Dashboard only so Analytics'
   and Production's plain .card usage is untouched. */
.role-farmer .two-col { gap: 16px; }
.role-farmer .two-col .card { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07); }
.role-farmer .dashboard-page .card:not(.stat-card) { padding: 20px; border-radius: 12px; }

/* Section header: sentence-case, bold, icon-first — matches admin's
   dashboard card headers (fw-semibold + icon, no divider). Overrides the
   uppercase/muted look admin.css's unscoped .section-label would otherwise
   bleed in, since that file loads after this one and wins the cascade on
   properties this rule doesn't set. */
.role-farmer .section-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  gap: 8px;
  margin-bottom: 16px;
}

/* Activity list */
.role-farmer .activity-row { padding: 14px 0; border-bottom-color: var(--border); }
.role-farmer .activity-main { font-size: 0.85rem; }
.role-farmer .activity-date { font-size: 0.75rem; margin-top: 3px; }
.role-farmer .activity-empty { padding: 4px 0; font-size: 0.83rem; color: var(--muted); }
.role-farmer .tag {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 11px;
}
/* Amber, not green — Fresh already owns green, so Dried needs its own hue
   to stay scannable at a glance. Amber also matches the tip box below
   ("Bilad earns double points"): Dried is the higher-value processing type. */
.role-farmer .tag-dried { background: #fff3d6; color: #b45309; }

/* ── Clean, human-designed Recent Activity ────────────────────── */
.role-farmer .fd-recent-activity-card {
  display: flex;
  flex-direction: column;
}

.role-farmer .fd-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.role-farmer .fd-activity-list {
  display: flex;
  flex-direction: column;
}

.role-farmer .fd-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 8px;
  border-bottom: 1px solid #f1f3f5;
  text-decoration: none !important;
  color: inherit !important;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.role-farmer .fd-activity-row:last-child {
  border-bottom: none;
}

.role-farmer .fd-activity-row:hover {
  background-color: #f8fafc;
}

.role-farmer .fd-activity-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.role-farmer .fd-activity-icon--fresh {
  background-color: #ecfdf5;
  color: #059669;
}

.role-farmer .fd-activity-icon--dried {
  background-color: #fffbeb;
  color: #d97706;
}

.role-farmer .fd-activity-details {
  min-width: 0;
  flex: 1;
}

.role-farmer .fd-activity-title {
  font-size: 0.91rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

.role-farmer .fd-activity-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.role-farmer .fd-activity-dot {
  color: #cbd5e1;
  font-weight: bold;
}

.role-farmer .fd-activity-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.role-farmer .fd-activity-value {
  font-size: 0.93rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.role-farmer .fd-activity-status {
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 7px;
  line-height: 1.4;
  text-transform: capitalize;
}

.role-farmer .fd-activity-status--paid {
  background-color: #ecfdf5;
  color: #047857;
}

.role-farmer .fd-activity-status--unpaid {
  background-color: #f1f5f9;
  color: #64748b;
}

/* Empty state */
.role-farmer .fd-activity-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 16px;
  text-align: center;
  color: #64748b;
  background: #fafafa;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  margin: 8px 0;
}

.role-farmer .fd-activity-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.role-farmer .fd-activity-empty-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.role-farmer .fd-activity-empty-desc {
  font-size: 0.8rem;
  color: #64748b;
  max-width: 300px;
  margin: 0 0 14px;
  line-height: 1.4;
}

.role-farmer .fd-activity-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 7px 16px;
  border-radius: 6px;
}

/* Performance insights — each metric is its own fa-insight-box (the same
   tinted-card component Analytics uses for growth callouts), so ranking
   and points-vs-average read as distinct, scannable cards instead of two
   plain text blocks separated by a hairline. */
.role-farmer .insight-block.fa-insight-box { margin-bottom: 12px; padding: 14px 16px; }
.role-farmer .insight-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.role-farmer .insight-val { font-size: 17px; font-weight: 700; margin: 3px 0; }
.role-farmer .insight-sub { font-size: 0.82rem; }
.role-farmer .fa-green .insight-label { color: #15803d; }
.role-farmer .fa-blue  .insight-label { color: #2563eb; }
.role-farmer .fa-red   .insight-label { color: #dc2626; }
/* --muted (#6b7280) falls just under 4.5:1 on these pale tints — same fix
   Analytics' .fa-insight-sub already applies for the identical reason. */
.role-farmer .insight-block.fa-insight-box .insight-sub { color: #55606f; }

/* Tip box — flat pale surface + hairline border, no marketing-card
   left accent stripe */
.role-farmer .tip-box {
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 0;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.role-farmer .tip-box i { color: var(--green-dark); font-size: 0.85rem; margin-top: 2px; flex-shrink: 0; }
.role-farmer .tip-box strong { color: var(--green-dark); }

/* Dashboard performance story — ranking, encouragement and comparison use
   the same live values as the KPI cards, presented with the richer visual
   hierarchy of the approved reference. */
.role-farmer .performance-insights-card { overflow: hidden; }
.role-farmer .performance-insights-title { font-size: clamp(1rem, 1.45vw, 1.35rem); }
.role-farmer .performance-ranking-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 32%);
  margin-bottom: 11px;
  overflow: hidden;
  border-left: 4px solid #22a447;
  border-radius: 12px;
  background: linear-gradient(105deg, #f2fbf5 0%, #eef8f1 64%, #f7fbf8 100%);
}
.role-farmer .performance-ranking-main {
  position: relative;
  min-width: 0;
  padding: clamp(15px, 2vw, 22px);
}
.role-farmer .performance-metric-heading,
.role-farmer .performance-average-metric {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}
.role-farmer .performance-icon-badge {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #087b37;
  background: #dff1e5;
  font-size: 1rem;
}
.role-farmer .performance-insights-card .insight-label {
  color: #277d4a;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .04em;
}
.role-farmer .performance-insights-card .insight-val {
  margin: 5px 0 8px;
  color: #111827;
  font-size: clamp(1.2rem, 1.8vw, 1.65rem);
  line-height: 1.15;
}
.role-farmer .performance-rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 10px;
  color: #087b37;
  background: #dcefe2;
  font-size: .8rem;
  font-weight: 750;
}
.role-farmer .performance-encouragement {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  margin-top: 15px;
}
.role-farmer .performance-encouragement strong { color: #176f38; font-size: clamp(.95rem, 1.35vw, 1.12rem); }
.role-farmer .performance-inline-leaf {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  margin-left: 8px;
  overflow: visible;
  vertical-align: -.23em;
}
.role-farmer .performance-inline-leaf path:first-child { fill: none; stroke: #229a47; stroke-linecap: round; stroke-width: 1.8; }
.role-farmer .performance-inline-leaf path:not(:first-child) { fill: #2fb255; }
.role-farmer .performance-encouragement span {
  max-width: 92%;
  color: #5b6878;
  font-size: .82rem;
  line-height: 1.48;
  text-align: justify;
  text-justify: inter-word;
}
.role-farmer .performance-watermark {
  position: absolute;
  right: 6%;
  top: 50%;
  width: clamp(7.5rem, 11vw, 10rem);
  height: clamp(10rem, 15vw, 13.5rem);
  color: rgba(42, 145, 76, .1);
  fill: currentColor;
  transform: translateY(-48%) rotate(3deg);
  pointer-events: none;
}
.role-farmer .performance-watermark-stem {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 7;
}
.role-farmer .performance-quote {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 14px 0;
  padding: 10px clamp(13px, 1.6vw, 18px);
  border-left: 1px solid #cfe1d4;
  color: #486475;
  font-size: clamp(.8rem, 1vw, .92rem);
  font-style: italic;
  line-height: 1.55;
  text-align: center;
}
.role-farmer .performance-quote::after {
  width: 42px;
  height: 3px;
  margin-top: 12px;
  border-radius: 10px;
  background: #2cad4e;
  content: '';
}
.role-farmer .performance-average-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(13rem, .85fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 11px;
  padding: clamp(13px, 1.6vw, 18px);
  border: 1px solid #d4e5da;
  border-left: 4px solid #278c48;
  border-radius: 12px;
  background: #fff;
}
.role-farmer .performance-average-panel--needs-growth { border-left-color: #d08a14; }
.role-farmer .performance-average-panel--needs-growth .performance-icon-badge { color: #a96508; background: #fff0ce; }
.role-farmer .performance-average-panel .insight-sub { color: #5b6878; font-size: .84rem; }
.role-farmer .performance-comparison-callout {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  color: #096b33;
  background: #edf8f0;
}
.role-farmer .performance-average-panel--needs-growth .performance-comparison-callout { color: #8a570d; background: #fff8e8; }
.role-farmer .performance-comparison-callout > i { flex: 0 0 auto; font-size: 1.45rem; }
.role-farmer .performance-comparison-callout div { display: grid; gap: 4px; min-width: 0; }
.role-farmer .performance-comparison-callout strong { font-size: .88rem; line-height: 1.3; }
.role-farmer .performance-comparison-callout span {
  color: #566574;
  font-size: .76rem;
  line-height: 1.42;
  text-align: justify;
  text-justify: inter-word;
}
.role-farmer .performance-tip-box {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-color: #bdddc7;
  border-radius: 12px;
  background: linear-gradient(90deg, #f3faf5, #edf6f0);
}
.role-farmer .performance-tip-box .performance-icon-badge { flex-basis: 34px; width: 34px; height: 34px; background: #e0f1e5; }
.role-farmer .performance-tip-box .performance-icon-badge i { margin: 0; font-size: 1.05rem; }
.role-farmer .performance-tip-box strong { font-size: .9rem; }
.role-farmer .performance-tip-box > span:last-child {
  color: #455665;
  font-size: .78rem;
  line-height: 1.42;
  text-align: justify;
  text-justify: inter-word;
}

@media (max-width: 1199px) {
  .role-farmer .performance-ranking-panel { grid-template-columns: 1fr; }
  .role-farmer .performance-quote { margin: 0 18px 18px; padding: 14px 0 0; border-top: 1px solid #cfe1d4; border-left: 0; }
  .role-farmer .performance-quote::after { margin-top: 12px; }
  .role-farmer .performance-average-panel { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
  .role-farmer .performance-ranking-main { padding: 16px 14px; }
  .role-farmer .performance-metric-heading,
  .role-farmer .performance-average-metric { gap: 10px; }
  .role-farmer .performance-icon-badge { flex-basis: 38px; width: 38px; height: 38px; font-size: .95rem; }
  .role-farmer .performance-insights-card .insight-val { font-size: clamp(1.2rem, 6vw, 1.5rem); overflow-wrap: anywhere; }
  .role-farmer .performance-rank-badge { padding: 5px 9px; font-size: .78rem; }
  .role-farmer .performance-encouragement { margin-top: 14px; }
  .role-farmer .performance-encouragement span { max-width: 100%; font-size: .82rem; }
  .role-farmer .performance-watermark { display: none; }
  .role-farmer .performance-quote { margin: 0 14px 14px; font-size: .8rem; }
  .role-farmer .performance-average-panel { gap: 13px; padding: 14px; }
  .role-farmer .performance-comparison-callout { gap: 10px; padding: 12px; }
  .role-farmer .performance-comparison-callout > i { font-size: 1.35rem; }
  .role-farmer .performance-tip-box { grid-template-columns: auto 1fr; gap: 8px 10px; padding: 12px; }
  .role-farmer .performance-tip-box > span:last-child { grid-column: 1 / -1; font-size: .8rem; }
}

/* ============================================================
   PRODUCTION PAGE
   ============================================================ */
.prod-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }

/* Scoped to .role-farmer — entrepreneur.css defines its own unscoped
   .btn-green that loads after this file and would otherwise win the
   cascade on every page (both stylesheets load globally, not per role). */
.role-farmer .btn-green {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-dark); color: #fff;
  border: none; border-radius: 50px; padding: 10px 22px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background 0.14s;
}
.role-farmer .btn-green:hover { background: var(--green-mid); color: #fff; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #444;
  border: 1px solid var(--border); border-radius: 50px; padding: 10px 22px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.14s;
}
.btn-outline:hover { background: var(--body-bg); }

/* Tabs — matches admin Production's .amfe-tab treatment: bordered boxy
   pills with a hover accent, not a filled pill-shaped toggle. */
.tab-row { display: flex; gap: 4px; margin-bottom: 20px; }
.tab-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 18px; border-radius: 8px; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--text);
  transition: all 0.15s;
}
.tab-btn > i { flex: 0 0 auto; font-size: 1rem; line-height: 1; }
.tab-btn:hover { border-color: var(--green-dark); color: var(--green-dark); }
.tab-btn.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

/* Production table — matches admin Production's .amfe-table: uppercase
   muted header band, tighter row padding, hover feedback. */
.amfe-table,
.prod-table { width: 100%; border-collapse: collapse; }
.amfe-table th,
.prod-table th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: #64748b; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 14px; border-bottom: 1.5px solid #e2e8f0;
  background: #fafafa;
}
.amfe-table td,
.prod-table td { padding: 11px 14px; font-size: 13.5px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.amfe-table tr:last-child td,
.prod-table tr:last-child td { border-bottom: none; }
.amfe-table tbody tr:hover,
.prod-table tbody tr:hover { background: #f9fafb; }

/* Dried Processing's per-month subtotal row — matches admin's
   .amfe-table tr.month-group-row exactly, so the two roles' "grouped by
   month, paid/unpaid + total points" tables read as one pattern. */
.amfe-table tr.month-group-row td,
.prod-table tr.month-group-row td {
  background: #f1f5f9;
  border-top: 2px solid #cbd5e1;
  border-bottom: 1.5px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  color: #1e293b;
}
.amfe-table tr.month-group-row:first-child td,
.prod-table tr.month-group-row:first-child td {
  border-top: none;
}
.amfe-table tr.month-group-row:hover td,
.prod-table tr.month-group-row:hover td { background: #e9eef4; }

/* Data rows */
.amfe-table tbody tr td,
.prod-table tr.prod-row td {
  padding: 12px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}
.amfe-table tbody tr:hover td,
.prod-table tr.prod-row:hover td {
  background: #f8fafc;
}

/* The table gets its own rounded, bordered box rather than bleeding to the
   parent .card's edges — mirrors admin Production's `.amfe-card.p-0`
   (border + var(--radius) + overflow:hidden), so the header band's corners
   are clipped to the radius instead of squaring off against it. overflow-x
   also lets a table wider than the card scroll inside this box instead of
   spilling past its edge. */
.prod-table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The table's own bottom border already separates it from what follows, so
   the shared pagination divider would land as a second line right under it. */
.prod-table-wrap + .pagination-bar { border-top: none; padding-top: 0; }

/* Points pill — matches admin's .badge-pts: a pale tinted chip, not a
   solid-fill badge, so it reads as a value label rather than a button. */
.badge-pts,
.pts-pill {
  background: #eaf5ee;
  color: #183126;
  border: 1px solid #c2e2d3;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}
.badge-pts--month,
.pts-pill--month {
  background: #2d6b50 !important;
  color: #ffffff !important;
  border: 1px solid #2d6b50 !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 3px 11px !important;
  border-radius: 20px !important;
  white-space: nowrap !important;
  display: inline-block !important;
  min-width: 80px !important;
  text-align: center !important;
}
.badge-pts--subtle,
.pts-pill--subtle {
  background: #eaf5ee !important;
  color: #166534 !important;
  border: 1px solid #c2e2d3 !important;
  font-weight: 600 !important;
  font-size: 11.5px !important;
  padding: 2.5px 10px !important;
  border-radius: 20px !important;
  white-space: nowrap !important;
  display: inline-block !important;
  min-width: 80px !important;
  text-align: center !important;
}

/* Sleek, minimalist stat boxes matching Picture 2 */
.detail-field {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 0;
}
.detail-field .field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 2px;
}
.detail-field .field-value {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

/* Clean, modern action edit pill button */
.action-btn-edit,
button.action-btn-edit {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #ffffff !important;
  color: #1b4332 !important;
  border: 1.5px solid #2d6a4f !important;
  border-radius: 9999px !important;
  padding: 3.5px 14px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease-in-out !important;
  line-height: 1.4 !important;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  outline: none !important;
}
.action-btn-edit:hover,
button.action-btn-edit:hover {
  background: #f0fdf4 !important;
  border-color: #15803d !important;
  color: #15803d !important;
}
.action-btn-edit i,
button.action-btn-edit i {
  font-size: 12px !important;
  color: inherit !important;
}
.action-btn-edit:hover i,
button.action-btn-edit:hover i {
  color: #15803d !important;
}

/* Dried history section title */
.history-title {
  font-size: 1.05rem; font-weight: 700; color: var(--green-dark); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.history-title i { font-size: 0.95rem; }

/* Add record forms */
.form-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; margin-bottom: 16px; }
.form-card h5 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 14px; }
/* Scoped to .role-farmer, unlike almost every other rule in this file:
   bare, this also wins on public guest pages (Login, Join, etc. — this
   file loads on every page) that were never meant to get Farmer's bolder
   label weight instead of global.css's baseline. */
.role-farmer .form-label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.form-input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 0.85rem; color: var(--text);
  background: #fff; outline: none;
  transition: border-color 0.14s;
}
.form-input:focus { border-color: var(--green-dark); }

/* Income month picker — calendar glyph on the LEFT.
   <input type="month"> draws its own picker button in the shadow DOM, and
   Chrome/Safari pin it to the trailing edge. It can't be moved by normal
   layout, so take it out of flow and pin it to the leading edge instead,
   then pad the text clear of it. Firefox exposes no such pseudo-element
   and shows no glyph at all, so the padding is all it sees — harmless. */
.income-month-input {
  position: relative;
  padding: 10px 14px 10px 40px;
  cursor: pointer;
}
.income-month-input::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  cursor: pointer;
}

/* ResponsiveMonthPicker is a button with its own trailing icon, not the
   native month input described above. Size it to the complete label and
   remove the native input's unused 40px leading gutter. */
.responsive-month-trigger.income-month-input {
  width: max-content;
  max-width: 100%;
  min-width: 0;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
}
.responsive-month-trigger.income-month-input .responsive-month-label {
  overflow: visible;
  text-overflow: clip;
}

@media (max-width: 767px) {
  /* .income-header is justify-content:space-between, so once it wraps the
     picker drops to its own line and sits hard left. Push it back to the
     trailing edge so it lines up under the fixed hamburger (right:12px)
     rather than sitting under the page title. */
  .income-header .income-month-input { margin-left: 0; }
}

/* Income header actions & export dropdown */
.role-farmer .income-header-actions {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
}
.role-farmer .btn-outline-amfe {
  background: transparent;
  color: var(--green-dark, #1e4d3a);
  border: 1.5px solid var(--green-dark, #1e4d3a);
  border-radius: 50px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.15s ease-in-out;
}
.role-farmer .btn-outline-amfe:hover,
.role-farmer .btn-outline-amfe:focus-visible {
  background: var(--green-dark, #1e4d3a);
  color: #ffffff;
}

.points-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-dark); color: #fff;
  border-radius: 8px; padding: 9px 14px;
  font-size: 0.82rem; font-weight: 700; margin: 10px 0;
}
.points-bar span { margin-left: 2px; }
.btn-row { display: flex; gap: 10px; margin-top: 4px; }

/* Add Record popup (.prod-add-modal, applied alongside the shared
   .modal-box-lg on the Production page only — admin's own modal-box-lg
   modals don't carry this class, so they're untouched): extra top/bottom
   padding on the box itself, plus taller fields, points bar and buttons,
   so the popup reads as a genuinely bigger dialog top-to-bottom, not just
   wider. Scoped to #production-form so Income/Settings keep the normal,
   more compact .form-input/.btn-green/.btn-outline elsewhere. */
.prod-add-modal { padding-top: 36px; padding-bottom: 36px; }
#production-form .form-label { font-size: 0.85rem; font-weight: 600; color: #374151; margin-bottom: 8px; }
#production-form .form-input {
  height: 48px;
  box-sizing: border-box;
  padding: 10px 14px;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border, #d1d5db);
  background: #fff;
}
#production-form .form-input:focus {
  border-color: var(--green-dark, #2d5a3d);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.12);
}

/* Production Stepper Component */
.prod-stepper-group {
  display: flex !important;
  align-items: stretch !important;
  width: 100%;
  height: 48px !important;
  box-sizing: border-box !important;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.prod-stepper-group:focus-within {
  border-color: var(--green-dark, #2d5a3d);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.12);
}
.prod-stepper-btn {
  width: 44px;
  height: 100% !important;
  min-height: unset !important;
  background: #f8faf9;
  border: none;
  color: var(--green-dark, #2d5a3d);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
  padding: 0;
}
.prod-stepper-btn:hover {
  background: #e8f3ec;
  color: #1e4d3a;
}
.prod-stepper-btn:active {
  background: #d5e9dc;
}
.prod-stepper-btn-minus {
  border-right: 1px solid var(--border, #e5e7eb) !important;
}
.prod-stepper-btn-plus {
  border-left: 1px solid var(--border, #e5e7eb) !important;
}
#production-form .prod-stepper-input {
  flex: 1 1 auto;
  width: 1% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  text-align: center;
  font-weight: 600;
  font-size: 1rem !important;
  color: #1f2937;
  padding: 0 8px !important;
  background: transparent;
  outline: none !important;
}

/* Bilad / Giling Participation Card */
.prod-checkbox-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 48px;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  margin-bottom: 0;
}
.prod-checkbox-card:hover {
  background: #fffdf5;
  border-color: #f59e0b;
}
.prod-checkbox-card.checked {
  background: #fffbeb;
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}
.prod-card-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #fef3c7;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.prod-checkbox-card.checked .prod-card-icon {
  background: #d97706;
  color: #ffffff;
}
.prod-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f2937;
}
.prod-custom-check {
  width: 19px;
  height: 19px;
  cursor: pointer;
  accent-color: #d97706;
  margin: 0;
}

/* Points / Notice bar */
#production-form .points-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f4f8f5;
  color: #1e3a29;
  border: 1px solid #d0e2d7;
  border-left: 4px solid var(--green-dark, #1e4d3a);
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 18px 0;
  line-height: 1.45;
}
#production-form .points-bar i {
  color: var(--green-dark, #1e4d3a);
  font-size: 1.15rem;
  flex-shrink: 0;
}
#production-form .points-bar.points-bar--amber {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
}
#production-form .points-bar.points-bar--amber i {
  color: #d97706;
}

#production-form .btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
#production-form .btn-row .btn-green {
  background: var(--green-dark, #1e4d3a);
  color: #fff;
  border-radius: 10px;
  height: 48px;
  padding: 0 26px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
#production-form .btn-row .btn-green:hover:not(:disabled) {
  background: #28644c;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.25);
}
#production-form .btn-row .btn-outline {
  height: 48px;
  padding: 0 24px;
  font-size: 0.95rem;
  border-radius: 10px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.field-group { margin-bottom: 0; }
.field-label {
  display: block; font-size: 0.72rem; font-weight: 600;
  color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px;
}
.field-val {
  background: var(--body-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 13px;
  font-size: 0.85rem; color: var(--text); min-height: 38px;
  word-break: break-word;
}
.field-note { font-size: 0.68rem; color: #bbb; margin-top: 3px; }

/* Edit-mode input */
.field-input {
  display: none;
  width: 100%;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  min-height: 38px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* border/padding/background scoped here: entrepreneur.css's unscoped
   .field-input (green border, 8.5px padding, --card-bg background) loads
   after this file with equal specificity and would otherwise win on every
   farmer profile edit field. */
.role-farmer .field-input {
  border: 1.5px solid var(--border);
  padding: 8px 12px;
  background: #fff;
}
.field-input:focus {
  border-color: var(--green-dark);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
}

/* Toggle: in edit mode, hide .field-val and show .field-input */
.profile-edit-mode .field-val  { display: none; }
.profile-edit-mode .field-input { display: block; }

/* Save-confirmation toast */
.profile-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green-dark);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
}
.profile-toast.show { opacity: 1; transform: translateY(0); }

/* Profile page header: title moves to fixed bar on mobile, leaving only the button */
.profile-header { display: flex; justify-content: space-between; align-items: flex-start; }
.profile-header-actions { display: flex; gap: 8px; }

/* Edit Profile / Cancel+Save render twice — once in the page header, once
   inline with the "Personal Information" heading. Exactly one is displayed
   at any width, so only one is ever in the a11y tree or tab order.
   Shared by Farmer/Profile and Entrepreneur/Profile. */
.profile-info-title { display: inline-flex; align-items: center; gap: 6px; }
.profile-inline-actions { display: none; }
.profile-identity-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  max-width: 72px;
  max-height: 72px;
  aspect-ratio: 1 / 1;
  flex: 0 0 72px;
  border: 2px solid var(--border);
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* farmer-sidebar.css intentionally makes ordinary content images responsive
   with height:auto. An avatar is a fixed square crop, so restore both axes
   with a selector strong enough to beat that shell-wide rule. This covers
   Farmer and Entrepreneur because both accounts use FarmerLayout. */
body.farmer-shell #main-content img.profile-avatar {
  width: 72px;
  height: 72px;
  min-width: 72px;
  min-height: 72px;
  max-width: 72px;
  max-height: 72px;
  border-radius: 50%;
  object-fit: cover;
}
.profile-identity-name {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
}
.profile-photo-change {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 6px;
  margin-bottom: 0;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.profile-photo-change i,
.profile-photo-change span { flex: 0 0 auto; }

/* Farmer's layout carries .role-farmer on #wrapper and farmer.css uses that
   to undo homepage.css's `.section-label { display:block !important;
   text-align:center }` (every stylesheet loads on every page). Entrepreneur's
   layout has no role class, so it never got that reset and this heading would
   render centred and block there. Re-do the reset unscoped, on this one
   heading only, so both roles behave the same without restyling every other
   card header. !important + 2 classes to outrank homepage.css's 1-class
   !important. */
.section-label.profile-info-label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
}

@media (max-width: 767px) {
  /* On a phone the header button sits alone on a full row above the card,
     which is a lot of vertical space for one control. Fold it into the
     section heading instead. */
  .profile-header-actions { display: none; }

  /* With the button hidden just above and .page-title pulled into the fixed
     top bar, .profile-header is an empty box — but it was still spending an
     18px bottom margin (an inline style, now removed from Farmer/Profile.jsx
     so CSS can reach it; the desktop 18px still comes from the unscoped
     .profile-header rule in entrepreneur.css) plus the 4px margin-top that
     the ≤991px .page-sub rule puts on the empty subtitle placeholder inside
     it. Both stacked under the bar and pushed the first card 32px down where
     every other farmer page sits at 10px. Scoped to .role-farmer so the
     entrepreneur profile, which shares these classes, keeps its own gap. */
  /* The empty .page-sub placeholder inside the header takes 4px of
     padding-top from the ≤991px rule further down, plus 4px of margin-top
     from entrepreneur.css — zero both, not just the margin. The header's
     own margin is zeroed further down too, next to the rule it has to
     beat. */
  .role-farmer .profile-header .page-sub { margin-top: 0; padding-top: 0; }
  /* Three classes deep on purpose: `.role-farmer .section-label` further
     down this file pins justify-content:flex-start (it exists to undo a
     `display:block !important; text-align:center` that homepage.css bleeds
     onto every page). A bare `.profile-info-label` loses to it on both
     specificity and source order, and the button would never move. */
  /* Two rules, not one: the .role-farmer variant is needed because
     `.role-farmer .section-label` (further down) pins justify-content
     :flex-start and would otherwise win on specificity + source order.
     The unscoped one covers Entrepreneur, which has no role class. */
  .section-label.profile-info-label,
  .role-farmer .section-label.profile-info-label {
    justify-content: space-between;
    gap: 10px;
  }
  .profile-inline-actions { display: flex; gap: 6px; flex-shrink: 0; }
  /* `.section-label i` paints every icon --green-dark, which would swallow
     the icon inside the filled green button. */
  .profile-inline-actions i,
  .role-farmer .profile-inline-actions i { color: inherit; }
  .profile-inline-actions .btn-green,
  .profile-inline-actions .btn-outline,
  .profile-inline-actions .btn-outline-cancel {
    padding: 7px 12px;
    font-size: 12px;
    white-space: nowrap;
  }
}

/* ============================================================
   ANALYTICS PAGE
   ============================================================ */

/* Tab pills — bordered white style matching admin */
.analytics-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.analytics-tab {
  padding: 10px 22px; border-radius: 50px;
  border: 1.5px solid var(--border);
  font-size: 14px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--text);
  display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.15s; white-space: nowrap; text-decoration: none;
  font-family: 'DM Sans', sans-serif;
}
.analytics-tab i { font-size: 14px; }
.analytics-tab.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }
.analytics-tab:hover:not(.active) { border-color: var(--green-dark); color: var(--green-dark); }

/* Shared filter bar below tabs */
.fa-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
}
.fa-filter-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }
.ana-filter-group { display: contents; }

/* Period select dropdown — matching admin ana-period-wrap / ana-period */
.fa-period-wrap { position: relative; display: inline-flex; align-items: center; }
.fa-period-wrap::after {
  content: '';
  position: absolute; right: 14px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  pointer-events: none;
}
.fa-period {
  border: 1.5px solid var(--border);
  border-radius: 50px;
  padding: 8px 36px 8px 18px;
  font-size: 13px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background: #fff;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

/* Year dropdown — matching admin ana-year-dropdown / ana-year-toggle */
.fa-year-dropdown { position: relative; display: inline-flex; align-items: center; }
.fa-year-toggle { padding: 8px 26px 8px 15px; position: relative; }
.fa-year-dropdown::after {
  content: '';
  position: absolute; right: 11px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-4px) rotate(45deg);
  pointer-events: none;
}
.fa-year-dropdown .dropdown-menu {
  min-width: 0;
  width: 116px;
  margin-top: 6px;
  padding: 5px 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  background: #58585a;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.34);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  max-height: 200px;
  overflow-y: auto;
}
.fa-year-dropdown .dropdown-item {
  padding: 6px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  text-align: left;
  position: relative;
}
.fa-year-dropdown .dropdown-item:hover,
.fa-year-dropdown .dropdown-item:focus { background: rgba(255, 255, 255, 0.14); color: #fff; }
.fa-year-dropdown .dropdown-item.active { background: transparent; color: #fff; }

/* Line / Bar toggle buttons */
.fa-chart-btn {
  padding: 8px 18px; border-radius: 50px;
  border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}
.fa-chart-btn.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }
.fa-chart-btn:hover:not(.active) { border-color: var(--green-dark); color: var(--green-dark); }

/* Chart card title — matches admin's fw-semibold at 15px */
.fa-card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--text); }

/* SVG line+dot legend below trend chart */
.fa-trend-legend { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.fa-legend-item  { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }

/* Insight boxes — 2×2 grid, matching admin color palette */
.fa-insight-box   { border-radius: 10px; padding: 18px 20px; height: 100%; border-left: 3px solid transparent; }
.fa-insight-title { font-size: 15.5px; font-weight: 700; margin-bottom: 6px; }
/* Darker than --muted: #6b7280 lands at 4.33:1 on the blue and amber tints
   below, just under the 4.5:1 floor for text this size. */
.fa-insight-text  { font-size: 14px; color: #3f4b5b; line-height: 1.6; }
/* Secondary line inside a box. Replaces an inline opacity:0.75 on already-muted
   text, which dropped the averages to roughly 2.8:1. */
.fa-insight-sub   { font-size: 0.78rem; color: #55606f; line-height: 1.55; margin-top: 6px; }
/* Measurement caveat under the panel — reads as a footnote, not a fifth insight. */
.fa-insight-footnote {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted); line-height: 1.55;
}
.fa-green  { background: #f0fdf4; border-left-color: #16a34a; } .fa-green  .fa-insight-title { color: #16a34a; }
.fa-blue   { background: #eff6ff; border-left-color: #3b82f6; } .fa-blue   .fa-insight-title { color: #3b82f6; }
.fa-purple { background: #faf5ff; border-left-color: #7c3aed; } .fa-purple .fa-insight-title { color: #7c3aed; }
.fa-amber  { background: #fffbeb; border-left-color: #d97706; } .fa-amber  .fa-insight-title { color: #d97706; }
.fa-red    { background: #fff1f2; border-left-color: #e63946; } .fa-red    .fa-insight-title { color: #e63946; }
/* Admin analytics uses a fifth accent for its extra insight box; kept here with
   the rest of the set so both Analytics pages draw from one palette. */
.fa-teal   { background: #f0fdfa; border-left-color: #0d9488; } .fa-teal   .fa-insight-title { color: #0d9488; }

/* Farmer-only diagnostic panel, based on this farmer's selected chart periods. */
.role-farmer .farmer-diagnostic {
  margin-bottom: 18px; border: 1px solid #cfe3d7; border-left: 5px solid #1e4d3a;
  border-radius: 16px; background: #f9fcfa; overflow: hidden;
}
.role-farmer .farmer-diagnostic-header {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 20px; border-bottom: 1px solid #e4eee8;
}
.role-farmer .farmer-diagnostic-icon {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  border-radius: 12px; color: #1e4d3a; background: #e7f5ed; font-size: 20px;
}
.role-farmer .farmer-diagnostic-header small { color: #166534; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.role-farmer .farmer-diagnostic-header h3 { margin: 2px 0; font-size: 19px; font-weight: 750; color: #17243a; }
.role-farmer .farmer-diagnostic-header p { margin: 0; font-size: 13px; color: #64748b; }
.role-farmer .farmer-diagnostic-period { margin-left: auto; padding: 8px 12px; border: 1px solid #bde0cb; border-radius: 999px; background: #fff; color: #166534; font-weight: 700; font-size: 12px; }
.role-farmer .farmer-diagnostic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 16px 20px; }
.role-farmer .farmer-diagnostic-grid > div { min-width: 0; padding: 12px; border: 1px solid #dce6e2; border-radius: 11px; background: #fff; }
.role-farmer .farmer-diagnostic-grid small { display: block; margin-bottom: 6px; color: #64748b; font-size: 11px; text-transform: uppercase; font-weight: 700; }
.role-farmer .farmer-diagnostic-grid strong { color: #17243a; font-size: 16px; overflow-wrap: anywhere; }
.role-farmer .farmer-diagnostic-explanation { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 20px 16px; }
.role-farmer .farmer-diagnostic-explanation > div { padding: 14px 16px; border: 1px solid #dce6e2; border-radius: 11px; background: #fff; }
.role-farmer .farmer-diagnostic-explanation > div:last-child { background: #f2fbf5; border-color: #bbefce; }
.role-farmer .farmer-diagnostic-explanation h4 { margin: 0 0 7px; font-size: 13px; font-weight: 750; color: #17243a; }
.role-farmer .farmer-diagnostic-explanation p { margin: 0; color: #405367; font-size: 13px; line-height: 1.5; }
.role-farmer .farmer-diagnostic-details { margin: 0 20px 18px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; }
.role-farmer .farmer-diagnostic-details summary { padding: 10px 14px; color: #1e4d3a; font-weight: 700; cursor: pointer; }
.role-farmer .farmer-diagnostic-details table { width: 100%; border-collapse: collapse; font-size: 12px; }
.role-farmer .farmer-diagnostic-details th, .role-farmer .farmer-diagnostic-details td { padding: 9px 12px; border-top: 1px solid #e2e8f0; text-align: left; white-space: nowrap; }
.role-farmer .farmer-diagnostic-details p { margin: 10px 14px; color: #64748b; font-size: 12px; }
@media (max-width: 767px) {
  .role-farmer .farmer-diagnostic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-farmer .farmer-diagnostic-explanation { grid-template-columns: 1fr; }
  .role-farmer .farmer-diagnostic-period { margin-left: 0; }
}

/* Canvas wrapper — taller to match admin chart height */
.chart-canvas-wrap {
  position: relative;
  height: 340px;
  width: 100%;
}

/* Pie chart wrapper + legend — matches admin's pie-chart-wrap */
.pie-chart-wrap { position: relative; height: 220px; flex: 1; min-height: 160px; }
.pie-legend { display: flex; justify-content: center; gap: 20px; margin-top: 14px; flex-wrap: wrap; }
.pie-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pie-legend-sq { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }

/* Legacy — kept for safety, no longer rendered */
.chart-card-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.chart-section-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; }
.pie-canvas-wrap { position: relative; height: 200px; max-width: 260px; margin: 0 auto; }
.chart-toggle-row { display: flex; gap: 6px; }
.chart-toggle {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 0.76rem; font-weight: 600; cursor: pointer;
  background: #fff; color: #555; display: flex; align-items: center; gap: 4px;
  transition: background 0.13s;
}
.chart-toggle.active { background: var(--green-dark); color: #fff; border-color: var(--green-dark); }

.insight-card { border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.insight-card:last-child { margin-bottom: 0; }
.insight-card-title  { font-size: 0.78rem; font-weight: 700; margin-bottom: 2px; }
.insight-card-body   { font-size: 0.8rem; }
.ic-green  { background: var(--green-badge); }
.ic-green .insight-card-title  { color: var(--green-dark); }
.ic-blue   { background: #dce8ff; }
.ic-blue .insight-card-title   { color: #2b5fb3; }
.ic-yellow { background: #fff8dc; }
.ic-yellow .insight-card-title { color: #b8860b; }
.ic-red    { background: #ffe4e4; }
.ic-red .insight-card-title    { color: #c0392b; }
.ic-purple { background: #f0e6ff; }
.ic-purple .insight-card-title { color: #6b21a8; }

.legend-row { display: flex; gap: 16px; margin-top: 8px; font-size: 0.75rem; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* ============================================================
   INCOME PAGE
   ============================================================ */
.income-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--body-bg);
  font-size: 0.84rem;
}
.income-row:last-child { border-bottom: none; }
.income-row .lbl { color: var(--muted); flex: 1; min-width: 0; overflow-wrap: break-word; }
.income-row .val { font-weight: 700; flex-shrink: 0; white-space: nowrap; margin-left: 8px; }
.val-red    { color: var(--red) !important; }
.val-green  { color: var(--green-dark) !important; }

/* Top stat row — vertical layout (icon badge floats top-right, label/value/sub
   stack below), distinct from Dashboard's horizontal .stat-card since these
   four cards carry a formula-style subtext line the dashboard ones don't. */
.role-farmer .income-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px 20px;
}
.role-farmer .income-stat-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--green-pale);
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.role-farmer .income-stat-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--muted); padding-right: 38px;
}
.role-farmer .income-stat-value { font-size: 23px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); line-height: 1.25; }
.role-farmer .income-stat-sub { font-size: 12px; color: var(--muted); }
.role-farmer .income-stat-note {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
}

/* Primary (dark) variant — Total This Month */
.role-farmer .income-stat-primary {
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-mid) 100%);
  border-color: transparent;
}
.role-farmer .income-stat-primary .income-stat-label { color: rgba(255,255,255,0.75); }
.role-farmer .income-stat-primary .income-stat-value { color: #fff; }
.role-farmer .income-stat-primary .income-stat-sub   { color: rgba(255,255,255,0.85); }
.role-farmer .income-stat-primary .income-stat-icon  { background: rgba(255,255,255,0.16); color: #fff; }

/* Income Composition — proportional stacked bar + dot legend */
.role-farmer .income-comp-bar {
  display: flex; height: 10px; border-radius: 6px; overflow: hidden;
  background: var(--body-bg); margin: 14px 0 16px;
}
.role-farmer .income-comp-seg { height: 100%; }
.role-farmer .income-comp-legend { display: flex; flex-wrap: wrap; gap: 22px; }
.role-farmer .income-comp-legend-item { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.role-farmer .income-comp-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.role-farmer .income-comp-legend-item .val { font-weight: 700; margin-left: 1px; }

/* Income Breakdown — two-line label rows (name + formula) */
.role-farmer .income-row-detail { align-items: flex-start; padding: 11px 0; }
.role-farmer .income-row-detail .lbl { color: var(--text); font-weight: 600; display: block; }
.role-farmer .income-row-detail .lbl-sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 3px; }
.role-farmer .income-row-detail .val { margin-top: 1px; }

/* Highlighted total row */
.role-farmer .income-row-total {
  margin-top: 8px; padding: 12px 14px;
  background: var(--green-pale);
  border-radius: 8px;
  border-bottom: none;
}
.role-farmer .income-row-total .lbl { font-weight: 700; color: var(--text); }
.role-farmer .income-row-total .val { font-size: 17px; }

/* Points & Pool footer — mirrors Income Breakdown's highlighted total row
   (.income-row-total) so both cards close on the same visual weight, then
   a single-segment bar in the Income Composition bar's language shows this
   farmer's points as a share of the co-op-wide pool. */
.role-farmer .income-pool-share { margin-top: 14px; }
.role-farmer .income-pool-share-label { font-size: 12.5px; color: var(--muted); }
.role-farmer .income-pool-share-pct { font-size: 12.5px; font-weight: 700; color: var(--green-dark); }
.role-farmer .income-pool-share-bar {
  height: 8px; border-radius: 6px; overflow: hidden;
  background: var(--body-bg); margin-top: 8px;
}
.role-farmer .income-pool-share-fill { height: 100%; background: var(--green-dark); border-radius: 6px; }
.role-farmer .income-pool-help {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* Income History / Historical Earnings / Pool Allocation — clickable disclosure header,
   chevron-only affordance instead of a button chip. */
.role-farmer .income-collapse-toggle {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.role-farmer .income-collapse-caret { color: var(--muted); font-size: 15px; }
.role-farmer .income-collapse-toggle:hover .income-collapse-caret { color: var(--green-dark); }

/* Pool Allocation Breakdown — compact & collapsible co-op transparency view */
.role-farmer .income-pool-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-pale);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--green-light);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.role-farmer .income-pool-badge strong {
  color: var(--green-dark);
}
/* Card Close X Button */
.role-farmer .btn-card-close-x {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border, #d8dfd9);
  background: #ffffff;
  color: var(--muted, #64748b);
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.role-farmer .btn-card-close-x:hover,
.role-farmer .btn-card-close-x:focus-visible {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: scale(1.05);
}

/* Pool Allocation Ledger Card UI */
.role-farmer .pool-ledger-card {
  background: #ffffff;
  border: 1px solid #d1e7dd;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.03);
}
.role-farmer .pool-ledger-gross {
  background: #f4faf6;
  border: 1px solid #b7dfca;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.role-farmer .pool-ledger-gross-title {
  font-size: 14px;
  color: var(--green-dark, #1e4d3a);
}
.role-farmer .pool-ledger-gross-sub {
  font-size: 12px;
  margin-top: 2px;
}
.role-farmer .pool-ledger-gross-val {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.3px;
}
.role-farmer .pool-ledger-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #64748b);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #edf2f0;
}
.role-farmer .pool-ledger-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.role-farmer .pool-ledger-item {
  padding: 8px 8px;
  border-radius: 6px;
  transition: background-color 0.12s ease;
  border-bottom: 1px dashed #f0f4f2;
}
.role-farmer .pool-ledger-item:last-child {
  border-bottom: none;
}
.role-farmer .pool-ledger-item:hover {
  background-color: #fbfdfc;
}
.role-farmer .pool-ledger-item-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.role-farmer .pool-ledger-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #1e293b;
}
.role-farmer .pool-ledger-item-detail {
  font-size: 12px;
  color: #64748b;
  margin-top: 1px;
}
.role-farmer .pool-ledger-item-val {
  font-size: 14px;
  font-weight: 600;
  color: #b91c1c;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.role-farmer .pool-ledger-total {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid #e2e8f0;
  font-size: 13.5px;
}

/* Pool Summary & Formula Card */
.role-farmer .pool-summary-box {
  background: linear-gradient(145deg, #f0f9f4 0%, #e6f5ec 100%);
  border: 1.5px solid #a7dfbc;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 6px rgba(30, 77, 58, 0.05);
}
.role-farmer .pool-summary-tag {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--green-dark, #1e4d3a);
  background: #ffffff;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid #b7dfca;
}
.role-farmer .pool-summary-amount {
  font-size: clamp(24px, 4vw, 30px);
  font-weight: 800;
  color: var(--green-dark, #1e4d3a);
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.role-farmer .pool-summary-note {
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin-top: 8px;
}
.role-farmer .pool-formula-box {
  background: #ffffff;
  border: 1px solid #b7dfca;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.role-farmer .pool-formula-header {
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green-dark, #1e4d3a);
}
.role-farmer .pool-formula-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.role-farmer .pool-step {
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  flex: 1 1 auto;
  text-align: center;
}
.role-farmer .pool-step-lbl {
  font-size: 9.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.role-farmer .pool-step-val {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
  white-space: nowrap;
}
.role-farmer .pool-step-operator {
  font-size: 15px;
  font-weight: 700;
  color: #64748b;
  padding: 0 1px;
}
.role-farmer .pool-step-highlight {
  background: #f4faf6;
  border-color: #a7dfbc;
}
.role-farmer .pool-step-highlight .pool-step-lbl {
  color: var(--green-dark, #1e4d3a);
}
.role-farmer .pool-step-highlight .pool-step-val {
  color: var(--green-dark, #1e4d3a);
  font-size: 13.5px;
}
.role-farmer .pool-farmer-share-card {
  background: #ffffff;
  border: 1px solid #d1e7dd;
  border-left: 3.5px solid var(--green-dark, #1e4d3a);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Payout Schedule & Work Logs Banner */
.role-farmer .income-payout-banner {
  background: #f4faf6;
  border: 1px solid #cce8d7;
  border-left: 4px solid var(--green-dark);
  border-radius: 12px;
  padding: 14px 18px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.role-farmer .income-payout-left {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 320px;
}
.role-farmer .income-payout-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #e3f3e9;
  color: var(--green-dark);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.role-farmer .income-payout-content {
  min-width: 0;
  flex: 1;
}
.role-farmer .income-payout-header-line {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}
.role-farmer .income-payout-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.role-farmer .income-payout-title strong {
  font-weight: 700;
  color: var(--green-dark);
}
.role-farmer .income-payout-details {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
}
.role-farmer .income-payout-details strong {
  color: var(--text);
  font-weight: 600;
}
.role-farmer .income-payout-sep {
  color: #94a3b8;
  margin: 0 4px;
  user-select: none;
}
.role-farmer .income-payout-subnote {
  color: #64748b;
}
.role-farmer .badge-payout-status {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.role-farmer .badge-payout-paid {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.role-farmer .badge-payout-ready {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.role-farmer .badge-payout-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.role-farmer .badge-payout-no_earnings {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.role-farmer .income-payout-actions {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  flex-shrink: 0;
}
.role-farmer .btn-income-work-logs {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
  background: #ffffff;
  border: 1px solid #b7dfca;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}
.role-farmer .btn-income-work-logs:hover,
.role-farmer .btn-income-work-logs:focus-visible {
  background: var(--green-dark);
  color: #ffffff;
  border-color: var(--green-dark);
  box-shadow: 0 3px 8px rgba(30, 77, 58, 0.2);
  text-decoration: none;
}
@media (max-width: 576px) {
  .role-farmer .income-payout-banner {
    padding: 12px 14px;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: stretch;
    align-items: stretch;
  }
  .role-farmer .income-payout-left {
    width: 100%;
    flex: 1 1 auto;
  }
  .role-farmer .btn-income-work-logs {
    width: 100%;
    -webkit-justify-content: center;
    justify-content: center;
  }
}

/* Quick Trend Pill inside Confirmed Income card */
.role-farmer .income-stat-primary .income-trend-pill {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  line-height: 1.3;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.role-farmer .income-stat-primary .income-trend-pill--up {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.role-farmer .income-stat-primary .income-trend-pill--down {
  background: rgba(254, 240, 138, 0.22);
  color: #fef08a;
  border: 1px solid rgba(254, 240, 138, 0.4);
}
.role-farmer .income-stat-primary .income-trend-pill--same,
.role-farmer .income-stat-primary .income-trend-pill--new {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.32);
}

/* Income card footer link to work logs */
.role-farmer .income-card-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}
.role-farmer .income-details-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green-dark);
  text-decoration: none;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 4px;
  transition: color 0.14s ease;
}
.role-farmer .income-details-link:hover {
  color: var(--green-mid);
  text-decoration: underline;
}
.role-farmer .income-help-icon {
  color: var(--muted);
  cursor: help;
  font-size: 13px;
}
.role-farmer .income-help-icon:hover {
  color: var(--green-dark);
}

/* Income history table */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th {
  text-align: left; font-size: 0.78rem; font-weight: 700;
  color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.role-farmer .income-page .history-table thead {
  background: #eaf6ee;
}
.role-farmer .income-page .history-table thead th {
  color: #5f6b66;
  border-bottom-color: #cfe4d6;
}
.history-table td { padding: 10px 10px; font-size: 0.82rem; border-bottom: 1px solid var(--body-bg); }
.history-table tr:last-child td { border-bottom: none; }

/* Income history card content flex & pagination */
.role-farmer .income-page .history-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 14px;
}
.role-farmer .income-page .history-card-content .pagination-bar {
  margin-top: auto;
  padding-top: 14px;
}
.role-farmer .income-page .history-table tbody tr:hover td {
  background: rgba(30, 77, 58, 0.03);
}

/* Historical Earnings & History toolbar badges */
.role-farmer .income-page .historical-total-badge {
  font-size: 12.5px;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.role-farmer .income-page .historical-total-badge strong {
  font-weight: 700;
  color: var(--green-dark);
}
.role-farmer .income-page .historical-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green-mid);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 14px;
}
.role-farmer .income-page .historical-notice-icon {
  color: var(--green-mid);
  font-size: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}
.role-farmer .income-page .historical-year-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: var(--body-bg);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: 0.3px;
}
.role-farmer .income-page .historical-period-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.92rem;
}
.role-farmer .income-page .historical-period-detail {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.35;
}
.role-farmer .income-page .history-tfoot-row td,
.role-farmer .income-page .historical-tfoot-row td {
  border-top: 2px solid var(--border);
  padding-top: 11px;
  padding-bottom: 11px;
}
.role-farmer .income-page .income-badge-sub {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--body-bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  letter-spacing: 0;
  text-transform: none;
}
.role-farmer .income-page .historical-status-paid {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-pale);
  border: 1px solid var(--green-light);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.role-farmer .income-page .historical-batch-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--body-bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}
.role-farmer .income-page .historical-footer-connect {
  background: #fbfcfb;
  border: 1px dashed var(--green-light);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.role-farmer .income-page .historical-footer-connect i {
  color: var(--green-dark);
  font-size: 14px;
  margin-top: 1px;
  flex-shrink: 0;
}

/* Larger type scale for this page only — .page-title/.page-sub/.section-label
   are shared with Dashboard/Production, so the bump is scoped through the
   .income-page wrapper instead of the bare class. */
.income-page .page-title { font-size: 32px; }
.income-page .page-sub { font-size: 0.95rem; }
.income-page .form-input { font-size: 0.95rem; }
.income-page .section-label { font-size: 16px; }
.role-farmer .income-page .income-comp-legend-item { font-size: 15px; }
.income-page .income-row { font-size: 0.95rem; }
.role-farmer .income-page .income-row-detail .lbl-sub { font-size: 13px; }
.role-farmer .income-page .income-row-total .val { font-size: 19px; }
.income-page .income-pool-share-label, .income-page .income-pool-share-pct { font-size: 13px; }
.income-page .tip-box { font-size: 0.88rem; }
.role-farmer .income-page .income-collapse-caret { font-size: 17px; }
.income-page .history-table th { font-size: 0.95rem; }
.income-page .history-table td { font-size: 1rem; }

/* Larger type scale for Dashboard only, same reasoning as .income-page
   above — stat cards (.stat-grid/.stat-card/.stat-icon) are deliberately
   left untouched. */
.role-farmer .dashboard-page .dash-welcome { font-size: 30px; }
.dashboard-page .page-sub { font-size: 0.95rem; }
.role-farmer .dashboard-page .section-label { font-size: 16px; }
.role-farmer .dashboard-page .activity-main { font-size: 0.95rem; }
.role-farmer .dashboard-page .activity-date { font-size: 0.85rem; }
.role-farmer .dashboard-page .activity-empty { font-size: 0.93rem; }
.role-farmer .dashboard-page .tag { font-size: 0.72rem; }
.role-farmer .dashboard-page .insight-label { font-size: 12.5px; }
.role-farmer .dashboard-page .insight-val { font-size: 19px; }
.role-farmer .dashboard-page .insight-sub { font-size: 0.86rem; }
.dashboard-page .tip-box { font-size: 0.88rem; }
.role-farmer .dashboard-page .tip-box i { font-size: 0.95rem; }
.history-table .td-red   { color: var(--red); font-weight: 600; }
.history-table .td-green { color: var(--green-dark); font-weight: 600; }

/* ── Stat cards: per-metric accent, adapted from the admin dashboard ──────
   Same anatomy as admin's stat row — white card, one pale accent border per
   metric, the colour payoff carried by the tinted icon badge, label and
   value left neutral so a row reads as one clean band rather than a set of
   tinted blocks. Shared by every farmer page with a stat row (Dashboard,
   Production, Income); a card opts in by carrying one fd-stat--* class, so
   nothing here touches a stat card that hasn't asked for it — notably
   Income's dark .income-stat-primary, which keeps its gradient.

   The values are duplicated from admin.css rather than reusing its
   .stat-card--* class names on purpose: admin.css loads after this file, so
   sharing its selectors would hand it the cascade on every farmer page and
   couple the two roles together. Each accent is a set of custom properties
   so the rules below stay colour-agnostic.

   Colour carries meaning across pages: green = fresh harvest, gold = points
   and dried value, blue = rank and entry counts, purple = everything else. */
.role-farmer .fd-stat--green  { --fd-accent: #8fc4a8; --fd-accent-bg: #e3f1e9; --fd-accent-fg: #1e4d3a; }
.role-farmer .fd-stat--gold   { --fd-accent: #d9c07a; --fd-accent-bg: #fbeecb; --fd-accent-fg: #8a6410; }
.role-farmer .fd-stat--amber  { --fd-accent: #f59e0b; --fd-accent-bg: #fef3c7; --fd-accent-fg: #b45309; }
.role-farmer .fd-stat--blue   { --fd-accent: #a5a1e0; --fd-accent-bg: #e7e9fa; --fd-accent-fg: #3d3f8f; }
.role-farmer .fd-stat--purple { --fd-accent: #cf9fbe; --fd-accent-bg: #f5e3ee; --fd-accent-fg: #7a3d63; }

.role-farmer [class*="fd-stat--"] { border-color: var(--fd-accent); }
/* Three classes deep so this clears both the plain green .stat-icon /
   .income-stat-icon defaults above and admin.css's later .stat-card
   .stat-icon, which would otherwise win on load order alone. */
.role-farmer [class*="fd-stat--"] .stat-icon,
.role-farmer [class*="fd-stat--"] .income-stat-icon {
  background: var(--fd-accent-bg);
  color: var(--fd-accent-fg);
}

/* Lift applies to every stat card, accented or not, so Income's dark primary
   card responds like the three beside it. */
.role-farmer .stat-card,
.role-farmer .income-stat {
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
/* Pointer-guarded: on touch, :hover latches after a tap and would leave one
   card floating until the next tap elsewhere. */
@media (hover: hover) and (pointer: fine) {
  .role-farmer .stat-card:hover,
  .role-farmer .income-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.09);
  }
}
@media (prefers-reduced-motion: reduce) {
  .role-farmer .stat-card,
  .role-farmer .income-stat { transition: none; }
  .role-farmer .stat-card:hover,
  .role-farmer .income-stat:hover { transform: none; }
}

/* homepage.css ships a marketing `.section-label` with `display: block
   !important; text-align: center`, and every role stylesheet loads on every
   page — which is what centres card headers like Profile's "Personal
   Information" and Income's "Income Breakdown". !important is the only way
   back to a left-aligned flex row, hence the escalation here. Labels that
   already sit inside a flex row (Income Composition, Income History) are
   unaffected: they are flex items either way. */
.role-farmer .section-label {
  display: flex !important;
  justify-content: flex-start;
  text-align: left;
}

/* "View all" affordance in a card header, pushed to the far end.
   --green-dark rather than --green-mid: at this size mid green falls short
   of 4.5:1 on the white card. */
.role-farmer .fd-see-all {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-dark);
  text-decoration: none;
  border-radius: 6px;
  padding: 2px 2px 2px 6px;
  white-space: nowrap;
}
.role-farmer .fd-see-all i { color: inherit; font-size: 0.85rem; }
.role-farmer .fd-see-all:hover { text-decoration: underline; }
.role-farmer .fd-see-all:focus-visible {
  outline: 2px solid var(--green-mid);
  outline-offset: 2px;
  text-decoration: underline;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 14px 26px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px;
}
.footer-brand { font-weight: 800; font-size: 0.95rem; color: var(--green-dark); letter-spacing: 2px; }
.footer-text  { font-size: 0.75rem; color: var(--muted); }

/* ════════════════════════════════════════════════════
   RESPONSIVE — ≤ 991px (tablet + mobile)
   ════════════════════════════════════════════════════ */
@media (max-width: 991px) {

  /* Sidebar: right-side slide-in drawer (mirrors admin behaviour) */
  #sidebar {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 260px;
    height: 100vh;
    transform: translateX(100%);
    z-index: 1050;
    border-right: none;
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  }
  #sidebar.show {
    transform: translateX(0);
  }

  /* Disable wrapper flex so sidebar doesn't push content */
  #wrapper {
    display: block;
  }

  /* Sidebar is an off-canvas drawer here, not a column — content shouldn't
     reserve space for it. */
  #main-content {
    margin-left: 0;
  }

  /* Stat grid: 2 columns on tablet */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Two-col panels: stack vertically */
  .two-col {
    grid-template-columns: 1fr;
  }

  /* Production header: on mobile the page-title is fixed, so only the button remains.
     Align it to the right. */
  .prod-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
  }

  /* Tab rows and analytics tabs: allow wrapping */
  .tab-row,
  .analytics-tabs {
    flex-wrap: wrap;
  }

  /* Analytics tabs: equal-width and centred on tablet */
  .analytics-tab {
    flex: 1;
    justify-content: center;
  }

  /* Page sub: breathing room below fixed header */
  .page-sub {
    padding-top: 4px;
  }

  /* Profile header: title is in fixed bar, collapse wrapper to the right.
     Scoped to .role-farmer: unscoped this leaked onto the entrepreneur
     profile — which has its own justify-content rule a few hundred lines
     up in entrepreneur.css — and its !important beat that page's own
     margin-bottom, so the entrepreneur profile silently kept 12px. */
  .role-farmer .profile-header {
    justify-content: flex-end;
    margin-bottom: 20px !important;
  }
}

/* The current member shell keeps the page title in normal content flow on
   phones. Preserve the same 20px title-to-content rhythm used by Settings,
   Activity Log, Announcements, Production, and Income. */
@media (max-width: 767px) {
  .role-farmer .profile-header { margin-bottom: 20px !important; }


  /* Card: slightly tighter padding on tablet. Scoped to .role-farmer —
     unscoped, this loses to entrepreneur.css's equal-specificity .card. */
  .role-farmer .card {
    padding: 16px 18px;
  }
  /* Dashboard's two-col cards carry a higher-specificity desktop padding
     (line ~279) to match admin's .amfe-card — restate the tablet shrink
     here so it isn't outranked. */
  .role-farmer .dashboard-page .card:not(.stat-card) {
    padding: 16px 18px;
  }

  .fa-filter-sep { display: none; }

  /* Chart height: slightly shorter on tablet */
  .chart-canvas-wrap { height: 320px; }
  .pie-canvas-wrap   { height: 180px; }

}

/* ════════════════════════════════════════════════════
   RESPONSIVE — ≤ 768px (mobile)
   ════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Tables: enable horizontal scroll */
  .prod-table,
  .history-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Form cards: tighter on phone */
  .form-card { padding: 16px 18px; }

  /* Chart card header (title + toggle buttons): stack when narrow */
  .card .d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Insight cards: tighter padding on mobile */
  .insight-card {
    padding: 10px 12px;
  }

  /* Legend row: allow wrapping on narrow screens */
  .legend-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
  }

}

/* ════════════════════════════════════════════════════
   RESPONSIVE — ≤ 576px (small mobile)
   ════════════════════════════════════════════════════ */
@media (max-width: 576px) {

  /* Income History follows the compact mobile card shown in the design:
     subtitle below the heading, three controls on one line, and a fitted
     four-column table rather than a horizontally scrolling desktop table. */
  .role-farmer .income-page .income-collapse-toggle {
    align-items: flex-start;
  }
  .role-farmer .income-page .income-collapse-toggle > .section-label {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .role-farmer .income-page .income-badge-sub {
    margin-left: 0;
    padding: 5px 10px;
    font-size: 11px;
  }
  .role-farmer .income-page .income-collapse-caret {
    margin-top: 3px;
  }
  .role-farmer .income-page .income-history-toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch !important;
    gap: 6px !important;
    width: 100%;
  }
  .role-farmer .income-page .income-history-toolbar > div:first-child {
    display: contents !important;
  }
  .role-farmer .income-page .income-history-toolbar .filter-select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding-inline: 10px 26px;
    background-position: right 9px center;
    font-size: 14px !important;
  }
  .role-farmer .income-page .income-history-toolbar .historical-total-badge {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 11px;
    overflow: hidden;
  }
  .role-farmer .income-page .income-history-toolbar .historical-total-badge strong {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .role-farmer .income-page .table-scroll {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
  }
  .role-farmer .income-page .history-table {
    display: table;
    table-layout: fixed;
    width: 100%;
    overflow: visible;
  }
  .role-farmer .income-page .history-table th,
  .role-farmer .income-page .history-table td {
    padding: 10px 7px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .role-farmer .income-page .history-table th:nth-child(1) { width: 28%; }
  .role-farmer .income-page .history-table th:nth-child(2) { width: 23%; }
  .role-farmer .income-page .history-table th:nth-child(3) { width: 23%; }
  .role-farmer .income-page .history-table th:nth-child(4) { width: 26%; }
  .role-farmer .income-page .history-table .td-green {
    overflow-wrap: normal;
    word-break: normal;
  }
  .role-farmer .income-page .history-tfoot-row {
    display: none;
  }
  .role-farmer .income-page .historical-earnings-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: flex-start !important;
  }
  .role-farmer .income-page .historical-earnings-year-filter {
    width: min(160px, 48%);
    min-height: 42px;
    align-self: flex-start;
  }
  .role-farmer .income-page .historical-earnings-toolbar .historical-total-badge {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 8px;
  }
  .role-farmer .income-page .income-pool-badge {
    max-width: 100%;
    padding: 5px 8px;
    gap: 4px;
    font-size: clamp(9px, 2.8vw, 12px);
    letter-spacing: -0.1px;
  }

  /* Stat grid: single column on small phone */
  .stat-grid {
    grid-template-columns: 1fr;
  }

  /* Stat card text group: allow shrinking */
  .stat-card > div:first-child { min-width: 0; }

  /* Slightly smaller stat values */
  .card-value { font-size: 17px; }

  /* Smaller welcome heading on phone */
  .dash-welcome { font-size: 22px; }

  /* Card: compact padding on phone. Scoped to .role-farmer — unscoped,
     this loses to entrepreneur.css's equal-specificity .card. */
  .role-farmer .card {
    padding: 12px 14px;
  }
  /* Dashboard's two-col cards carry a higher-specificity desktop padding
     (line ~279) to match admin's .amfe-card — restate the phone shrink
     here so it isn't outranked. */
  .role-farmer .dashboard-page .card:not(.stat-card) {
    padding: 12px 14px;
  }

  /* Analytics tabs: 3 equal columns in one row on small phone */
  .analytics-tab {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
    font-size: 0.74rem;
    gap: 4px;
    white-space: nowrap;
  }

  /* Chart height: compact on phone */
  .chart-canvas-wrap { height: 220px; }

  /* Filter bar: let the period/year pickers and chart-type buttons wrap
     onto their own row instead of overflowing off the right edge —
     matches admin.css's .ana-filter-bar fix. */
  /* Filter bar layout on mobile: Row 1 = period/year/range in 1 line; Row 2 = download */
  .fa-filter-bar,
  .ana-filter-bar {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    gap: 8px !important;
    padding: 8px !important;
    border-radius: 18px !important;
  }
  .ana-filter-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .fa-filter-sep,
  .ana-filter-sep { display: none !important; }
  .ana-filter-group .fa-period-wrap,
  .ana-filter-group .ana-period-wrap,
  .ana-filter-group .analytics-range {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    position: relative !important;
  }
  .ana-filter-group .fa-year-dropdown,
  .ana-filter-group .ana-year-dropdown {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 64px !important;
    margin: 0 !important;
    position: relative !important;
  }
  .farmer-analytics-export {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    position: relative !important;
  }
  .fa-period,
  .ana-period,
  .ana-period-toggle,
  .ana-year-toggle,
  .analytics-range-toggle,
  .farmer-download-toggle {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1.5px solid var(--border, #d8dfdb) !important;
    border-radius: 999px !important;
    background: #fff !important;
    font-size: 12px !important;
  }
  .fa-chart-btn { flex: 1 1 auto; justify-content: center; padding: 6px 12px; font-size: 12px; }

  /* Insight boxes: compact padding on small phone (font sizes match admin) */
  .fa-insight-box { padding: 12px 14px; }
  .fa-insight-footnote { font-size: 0.7rem; margin-top: 12px; padding-top: 10px; }

  /* Chart toggle row: wrap and compact */
  .chart-toggle-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  .chart-toggle { font-size: 0.72rem; padding: 4px 8px; }

  /* Insight card: compact */
  .insight-card { padding: 9px 11px; margin-bottom: 6px; }
  .insight-card-title { font-size: 0.75rem; }
  .insight-card-body  { font-size: 0.76rem; }

  /* Income rows: tighter vertical padding on small phone */
  .income-row { padding: 7px 0; }

  /* Form card: compact on small phone */
  .form-card { padding: 12px 14px; }

  /* Btn row: wrap and full-width buttons on very small screens */
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn-green,
  .btn-row .btn-outline { flex: 1; justify-content: center; }

  /* Save-confirmation toast: clamp both edges instead of a fixed right
     offset, so a longer (e.g. translated) message can't run past the
     left edge of a narrow phone — matches entrepreneur.css's .save-toast. */
  .profile-toast { left: 16px; right: 16px; justify-content: center; }

}

/* ════════════════════════════════════════════════════
   DASHBOARD — role-farmer scoped responsive refinements
   (kept separate from the shared rules above so tablet/phone
   sizing can differ from the desktop values set earlier in
   this file without fighting them on specificity)
   ════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  /* Restore the original responsive KPI layout. This must be role-scoped:
     entrepreneur.css loads after this file, and a shared selector previously
     allowed one account's KPI change to leave Farmer cards in four squeezed
     columns when DevTools narrowed the viewport. */
  .role-farmer .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
  }
  .role-farmer .stat-card > div:first-child { min-width: 0; }
  .role-farmer .stat-card .card-title {
    overflow-wrap: normal;
    word-break: normal;
  }
  .role-farmer .two-col { gap: 16px; }
}

@media (max-width: 576px) {
  .role-farmer .stat-grid { grid-template-columns: 1fr; }
  .role-farmer .dash-welcome { font-size: 23px; }
  .role-farmer .dash-welcome + .page-sub { margin-bottom: 20px; }
  .role-farmer .card-value { font-size: 20px; }
  .role-farmer .stat-card { padding: 16px; }
  .role-farmer .stat-icon { width: 36px; height: 36px; font-size: 1rem; }
}
/* ════════════════════════════════════════════════════
   PRODUCTION HISTORY — table → cards on mobile/tablet (≤991px)
   Five columns of dried-processing data cannot hold their
   shape in a 400px viewport. .prod-table-wrap's overflow-x
   never engaged because the table is width:100%, so instead
   of scrolling the columns squeezed: the header ran to three
   lines ("DATE / & / TIME"), "Jul 30, 2026" shredded the same
   way, and the points pill broke across two lines with its
   own rounded background clipped in half.

   Same fix admin's #freshTable/#driedTable already use — the
   row becomes a card and each cell prints its own header from
   the data-label attribute. The compact card layout continues
   through portrait-tablet widths; desktop/laptop keeps the table.
   ════════════════════════════════════════════════════ */
@media (max-width: 991.98px) {

  /* The bordered, clipped box belongs to the table. Once the rows
     are free-standing cards it is only a box drawn around boxes.
     Scoped to .role-farmer for specificity: responsive.css loads last
     and re-asserts .prod-table-wrap { overflow-x: auto } at ≤768px. */
  .role-farmer .prod-table-wrap,
  .role-farmer .table-responsive {
    border: none;
    border-radius: 0;
    overflow-x: visible;
  }
  .role-farmer .prod-table-wrap + .pagination-bar { padding-top: 4px; }

  #freshHistoryTable,
  #freshHistoryTable tbody,
  #driedHistoryTable,
  #driedHistoryTable tbody { display: block; }

  #freshHistoryTable thead,
  #driedHistoryTable thead { display: none; }

  #freshHistoryTable tbody tr:not(.month-group-row),
  #driedHistoryTable tbody tr:not(.month-group-row) {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
  }

  #freshHistoryTable tbody tr:not(.month-group-row) td,
  #driedHistoryTable tbody tr:not(.month-group-row) td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 13.5px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
  }
  #freshHistoryTable tbody tr:not(.month-group-row) td:last-child,
  #driedHistoryTable tbody tr:not(.month-group-row) td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  #freshHistoryTable tbody tr:not(.month-group-row) td::before,
  #driedHistoryTable tbody tr:not(.month-group-row) td::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #626b76;
    min-width: 90px;
  }

  /* Actions cell in farmer cards */
  #freshHistoryTable tbody td.prod-actions,
  #driedHistoryTable tbody td.prod-actions {
    border-bottom: none;
    padding-top: 10px;
    justify-content: flex-end;
  }
  #freshHistoryTable tbody td.prod-actions::before,
  #driedHistoryTable tbody td.prod-actions::before { display: none; }

  /* ── Month subtotal stays a section header, never a card — it is the
        band the cards below belong to, and it carries the paid/unpaid
        state for the whole month. */
  #freshHistoryTable tbody tr.month-group-row,
  #driedHistoryTable tbody tr.month-group-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 18px 0 10px;
  }
  #freshHistoryTable tbody tr.month-group-row:first-child,
  #driedHistoryTable tbody tr.month-group-row:first-child { margin-top: 0; }

  .prod-table tr.month-group-row td,
  .prod-table tr.month-group-row:hover td {
    background: transparent;
  }
  #freshHistoryTable tbody tr.month-group-row td,
  #driedHistoryTable tbody tr.month-group-row td {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none !important;
    font-size: 13px;
    text-align: left;
    background: transparent;
  }
  #freshHistoryTable tbody tr.month-group-row td::before,
  #driedHistoryTable tbody tr.month-group-row td::before { display: none !important; }

  #freshHistoryTable tbody tr.month-group-row td.mg-label,
  #driedHistoryTable tbody tr.month-group-row td.mg-label { flex: 1 1 100%; min-width: 0; margin-bottom: 2px; }
  #driedHistoryTable tbody tr.month-group-row td.mg-himay,
  #driedHistoryTable tbody tr.month-group-row td.mg-bilad-giling {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 600;
    color: #475569;
    background: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
  }
  #freshHistoryTable tbody tr.month-group-row td.mg-total,
  #driedHistoryTable tbody tr.month-group-row td.mg-total {
    flex: 0 0 auto;
    font-weight: 700;
    text-align: right;
    margin-left: auto;
  }
  /* The blank subtotal row cell is a spacer for the table's column count;
     as a flex child it would be an invisible gap. */
  #freshHistoryTable tbody tr.month-group-row td.mg-blank,
  #driedHistoryTable tbody tr.month-group-row td.mg-blank { display: none !important; }
}

/* ════════════════════════════════════════════════════
   PRODUCTION FILTERS — phone stacking (≤576px)
   Four full-width controls in a column pushed the first row of
   data below the fold. Year and Month are one decision made in
   two halves, so they share a row; search and payment status
   each keep a full one.
   ════════════════════════════════════════════════════ */
@media (max-width: 576px) {
  /* global.css turns every .d-flex.gap-2.flex-wrap into a column below
     480px. That is what stacked all four controls full-width, and left
     unchallenged it combines with the flex bases below into a *column*
     wrap — the controls fill one column, then start a second one off the
     right edge. Take the direction back at a specificity that outranks
     it (0,4,0 vs 0,3,0). */
  .role-farmer .prod-filter-row.d-flex.flex-wrap {
    flex-direction: row;
  }

  .role-farmer .tab-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    width: 100%;
  }
  .role-farmer .tab-row .tab-btn {
    width: 100%;
    min-width: 0;
    padding-inline: .5rem;
    white-space: normal;
    text-align: center;
  }

  .prod-filter-row > .prod-filter-year,
  .prod-filter-row > .prod-filter-month {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
  }
  .prod-filter-row > .search-wrap,
  .prod-filter-row > .prod-filter-payment {
    flex: 1 1 100%;
    min-width: 0 !important;
    width: 100%;
  }
}

@media (min-width: 992px) {
  #freshHistoryTable th,
  #freshHistoryTable td:not(.mg-label),
  #driedHistoryTable th:not(.dried-date-th):not(:first-child),
  #driedHistoryTable td:not(.mg-label):not(:first-child) {
    text-align: center !important;
  }

  #freshHistoryTable th:first-child,
  #freshHistoryTable td:first-child:not(.mg-label),
  #freshHistoryTable td[data-label="Date & Time"],
  #freshHistoryTable td[data-label="Petsa at Oras"],
  #driedHistoryTable th.dried-date-th,
  #driedHistoryTable th:first-child,
  #driedHistoryTable td:first-child:not(.mg-label),
  #driedHistoryTable td.dried-date-cell,
  #driedHistoryTable td[data-label="Date & Time"],
  #driedHistoryTable td[data-label="Petsa at Oras"] {
    text-align: left !important;
    padding-left: 14px !important;
  }

  #freshHistoryTable td:first-child:not(.mg-label) > div,
  #freshHistoryTable td.dried-date-cell > div,
  #freshHistoryTable td[data-label="Date & Time"] > div,
  #freshHistoryTable td[data-label="Petsa at Oras"] > div,
  #driedHistoryTable td:first-child:not(.mg-label) > div,
  #driedHistoryTable td.dried-date-cell > div,
  #driedHistoryTable td[data-label="Date & Time"] > div,
  #driedHistoryTable td[data-label="Petsa at Oras"] > div {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: auto !important;
  }
}

/* ════════════════════════════════════════════════════
   FARMER PRODUCTION — Responsive Stat Grid & Cards
   Desktop (>991px): 4 cols for dried, 2 cols for fresh
   Tablet & Mobile (≤991px down to 320px):
   Always 2 stat cards per row ("tig dalwang stat card")
   ════════════════════════════════════════════════════ */
.role-farmer .prod-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.role-farmer .prod-stat-grid.prod-stat-grid--fresh {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.role-farmer .prod-stat-card {
  min-width: 0;
  min-height: 104px;
  padding: 18px 20px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--fd-accent, var(--border));
  box-shadow: 0 4px 14px rgba(30, 77, 58, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.role-farmer .prod-stat-card .prod-stat-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.role-farmer .prod-stat-card .card-title {
  color: #66707c;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  line-height: 1.35;
  margin-bottom: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.role-farmer .prod-stat-card .card-value {
  margin-top: 6px;
  color: #171717;
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.role-farmer .prod-stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 17px;
  margin-top: 1px;
}

/* Tablet & Mobile responsive behavior: exactly 2 cards per row ("tig dalwang stat card") */
@media (max-width: 991px) {
  .role-farmer .prod-stat-grid,
  .role-farmer .prod-stat-grid.prod-stat-grid--fresh {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
    margin-bottom: 18px;
  }

  .role-farmer .prod-stat-card {
    min-height: 96px;
    padding: 16px 16px;
    border-radius: 14px;
    gap: 10px;
  }

  .role-farmer .prod-stat-card .card-value {
    font-size: clamp(17px, 2.5vw, 21px);
    margin-top: 5px;
  }

  .role-farmer .prod-stat-card .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* Mobile phones (≤ 576px down to small phones) */
@media (max-width: 576px) {
  .role-farmer .prod-stat-grid,
  .role-farmer .prod-stat-grid.prod-stat-grid--fresh {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
    margin-bottom: 16px;
  }

  .role-farmer .prod-stat-card {
    min-height: 84px;
    padding: 12px 12px;
    gap: 8px;
    border-radius: 14px;
  }

  .role-farmer .prod-stat-card .card-title {
    font-size: 10px;
    letter-spacing: 0.035em;
  }

  .role-farmer .prod-stat-card .card-value {
    font-size: clamp(15px, 4vw, 18px);
    margin-top: 4px;
    font-weight: 750;
  }

  .role-farmer .prod-stat-card .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-top: 0;
  }

  /* Keep Add Record popup compact on phone screens */
  .prod-add-modal {
    padding-top: 22px;
    padding-bottom: 24px;
  }
}

/* Very narrow phones (≤ 360px) */
@media (max-width: 360px) {
  .role-farmer .prod-stat-grid,
  .role-farmer .prod-stat-grid.prod-stat-grid--fresh {
    gap: 6px;
  }

  .role-farmer .prod-stat-card {
    padding: 10px 8px;
    gap: 6px;
    min-height: 78px;
  }

  .role-farmer .prod-stat-card .card-title {
    font-size: 9.5px;
  }

  .role-farmer .prod-stat-card .card-value {
    font-size: 14px;
  }

  .role-farmer .prod-stat-card .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}

/* ============================================================
   FARMER PRODUCTION — device-complete responsive layout
   Keep this page isolated from the Admin production selectors that are
   loaded globally after the Farmer stylesheet.
   ============================================================ */
.role-farmer .farmer-production-page {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.role-farmer .farmer-production-page > .card {
  min-width: 0;
  overflow: visible;
}

.role-farmer .farmer-production-page .prod-filter-row > * {
  min-width: 0;
}

@media (max-width: 991.98px) {
  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-header {
    width: 100%;
    min-width: 0;
    padding-right: 0;
  }

  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-header .page-title {
    position: static;
    inset: auto;
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    color: var(--text, #1a1a2e);
    background: transparent;
    line-height: 1.2;
    white-space: normal;
  }

  .role-farmer .farmer-production-page .prod-header > .d-flex {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .role-farmer .farmer-production-page .prod-filter-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
    width: 100%;
  }

  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-filter-row > .content-select,
  .role-farmer .farmer-production-page .prod-filter-row > .search-wrap {
    width: 100% !important;
    max-width: none;
  }

  .role-farmer .farmer-production-page .prod-filter-row > .search-wrap,
  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-filter-payment {
    grid-column: 1 / -1;
  }
}

@media (max-width: 991.98px) {
  /* Historical/simulated records use the same readable mobile cards as the
     live Fresh and Dried tables instead of squeezing four desktop columns. */
  .role-farmer .farmer-production-page #simulatedHistoryTable,
  .role-farmer .farmer-production-page #simulatedHistoryTable tbody {
    display: block;
    width: 100%;
  }

  .role-farmer .farmer-production-page #simulatedHistoryTable thead {
    display: none;
  }

  .role-farmer .farmer-production-page #simulatedHistoryTable tbody tr {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
  }

  .role-farmer .farmer-production-page #simulatedHistoryTable tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 8px 0 !important;
    border-bottom: 1px solid #f1f3f5;
    text-align: right !important;
    white-space: normal !important;
    font-variant-numeric: tabular-nums;
  }

  .role-farmer .farmer-production-page #simulatedHistoryTable tbody td:last-child {
    border-bottom: 0;
  }

  .role-farmer .farmer-production-page #simulatedHistoryTable tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 48%;
    color: #626b76;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    line-height: 1.3;
    text-align: left;
    text-transform: uppercase;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody tr:not(.month-group-row) td,
  .role-farmer .farmer-production-page #driedHistoryTable tbody tr:not(.month-group-row) td {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    min-width: 0;
    width: 100%;
    padding: 8px 0 !important;
    border-bottom: 1px solid #f1f3f5 !important;
    font-size: 13.5px;
    text-align: right !important;
    white-space: normal !important;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody tr:not(.month-group-row) td:last-child,
  .role-farmer .farmer-production-page #driedHistoryTable tbody tr:not(.month-group-row) td:last-child {
    border-bottom: none !important;
    padding-bottom: 0 !important;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody tr:not(.month-group-row) td::before,
  .role-farmer .farmer-production-page #driedHistoryTable tbody tr:not(.month-group-row) td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .5px;
    line-height: 1.3;
    text-align: left !important;
    text-transform: uppercase;
    color: #626b76;
    white-space: nowrap;
    max-width: 48%;
  }

  /* Date & Time placing: right-aligned, chips & date stay together with no word splitting */
  .role-farmer .farmer-production-page #freshHistoryTable td[data-label] > .d-flex,
  .role-farmer .farmer-production-page #driedHistoryTable td[data-label] > .d-flex,
  .role-farmer .farmer-production-page .prod-record-date {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    text-align: right !important;
    flex-wrap: wrap !important;
  }

  .role-farmer .farmer-production-page .prod-record-date-text {
    color: #1e293b;
    font-weight: 500;
    white-space: nowrap !important;
  }

  /* Badges in cards: solid chip, never wrap mid-word */
  .role-farmer .farmer-production-page .badge-paid,
  .role-farmer .farmer-production-page .badge-unpaid,
  .role-farmer .farmer-production-page .badge-pts,
  .role-farmer .farmer-production-page .badge {
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    padding: 3px 8px !important;
    border-radius: 9999px !important;
    line-height: 1.25 !important;
  }

  /* Record values: number and unit (kg, pts) kept tightly together */
  .role-farmer .farmer-production-page .prod-record-value {
    display: inline-flex !important;
    align-items: baseline !important;
    justify-content: flex-end !important;
    gap: 3.5px !important;
    max-width: none !important;
    white-space: nowrap !important;
    margin-left: auto !important;
    text-align: right !important;
  }

  /* Actions row inside card: Edit button placed on the right side */
  .role-farmer .farmer-production-page #freshHistoryTable tbody td.prod-actions,
  .role-farmer .farmer-production-page #driedHistoryTable tbody td.prod-actions,
  #freshHistoryTable tbody td.prod-actions,
  #driedHistoryTable tbody td.prod-actions {
    display: flex !important;
    width: 100% !important;
    max-width: none !important;
    justify-content: flex-end !important;
    align-items: center !important;
    text-align: right !important;
    padding-top: 10px !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody td.prod-actions::before,
  .role-farmer .farmer-production-page #driedHistoryTable tbody td.prod-actions::before,
  #freshHistoryTable tbody td.prod-actions::before,
  #driedHistoryTable tbody td.prod-actions::before {
    display: none !important;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody td.prod-actions > *,
  .role-farmer .farmer-production-page #driedHistoryTable tbody td.prod-actions > *,
  #freshHistoryTable tbody td.prod-actions > *,
  #driedHistoryTable tbody td.prod-actions > * {
    margin-right: 0 !important;
    margin-left: auto !important;
    display: inline-flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
  }

  .role-farmer .farmer-production-page #freshHistoryTable tbody td.prod-actions .action-btn-edit,
  .role-farmer .farmer-production-page #driedHistoryTable tbody td.prod-actions .action-btn-edit,
  #freshHistoryTable tbody td.prod-actions .action-btn-edit,
  #driedHistoryTable tbody td.prod-actions .action-btn-edit {
    margin-right: 0 !important;
    margin-left: auto !important;
  }

  .role-farmer .farmer-production-page #driedHistoryTable tbody tr.month-group-row td.mg-payment {
    display: inline-flex;
    margin-left: 0;
  }
}

@media (max-width: 576.98px) {
  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px !important;
  }

  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-header .page-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(1.55rem, 7vw, 1.85rem) !important;
  }

  .role-farmer .farmer-production-page .prod-header > .d-flex {
    flex: 0 0 auto;
  }

  .role-farmer .farmer-production-page .prod-header .btn-outline-amfe {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 12px;
    white-space: nowrap;
  }

  .role-farmer .farmer-production-page > .card {
    padding: 12px !important;
    border-radius: 12px;
  }

  .role-farmer .farmer-production-page .tab-row {
    align-items: stretch;
  }

  .role-farmer .farmer-production-page .tab-row .tab-btn {
    min-height: 48px;
    line-height: 1.25;
  }

  body.farmer-shell .role-farmer .farmer-production-page .mobile-add-fab {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    min-height: 48px;
    padding: 11px 17px;
  }

  .role-farmer .farmer-production-page .prod-add-modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top));
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 16px 16px 0 0;
  }

  .role-farmer .farmer-production-page #production-form .points-bar {
    align-items: flex-start;
    line-height: 1.4;
  }
}

@media (max-width: 374.98px) {
  body.farmer-shell .role-farmer #main-content .farmer-production-page .prod-header {
    align-items: stretch;
    flex-direction: column;
  }

  .role-farmer .farmer-production-page .prod-header > .d-flex,
  .role-farmer .farmer-production-page .prod-header .dropdown,
  .role-farmer .farmer-production-page .prod-header .btn-outline-amfe {
    width: 100%;
  }

  .role-farmer .farmer-production-page .prod-header .btn-outline-amfe {
    justify-content: center;
  }

  .role-farmer .farmer-production-page .prod-stat-card .stat-icon {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .role-farmer .farmer-production-page .prod-stat-card .card-value {
    font-size: 13.5px;
  }

  .role-farmer .farmer-production-page #production-form .btn-row {
    align-items: stretch !important;
    flex-direction: column;
  }

  .role-farmer .farmer-production-page #production-form .btn-row > .d-flex {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .role-farmer .farmer-production-page #production-form .btn-row .btn-green,
  .role-farmer .farmer-production-page #production-form .btn-row .btn-outline,
  .role-farmer .farmer-production-page #production-form .btn-row > .btn {
    width: 100%;
    min-width: 0;
    padding-inline: 10px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .role-farmer .farmer-production-page .prod-add-modal {
    max-height: calc(100dvh - 16px);
    padding-top: 16px;
    padding-bottom: 16px;
  }
}


