:root {
  --ink: #18231d;
  --muted: #6c766f;
  --line: #dde4de;
  --canvas: #f3f5f0;
  --surface: #ffffff;
  --green: #176b45;
  --green-dark: #0d4f32;
  --green-soft: #dceee4;
  --gold: #dca63a;
  --gold-soft: #f8edcf;
  --blue: #3b78a8;
  --blue-soft: #dceaf3;
  --coral: #c7674e;
  --coral-soft: #f4e1db;
  --shadow: 0 10px 35px rgba(24, 35, 29, 0.07);
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "DM Sans", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23, 107, 69, 0.24); outline-offset: 2px; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: var(--sidebar-width); flex-direction: column; padding: 26px 18px 18px; color: #f7fbf8; background: #123d2a; background-image: radial-gradient(circle at 18px 18px, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 18px 18px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.25); background: #f2cf69; color: #123d2a; }
.brand-mark svg { width: 23px; }
.brand strong { display: block; font-family: "Fraunces", serif; font-size: 20px; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #9ec7af; font-size: 9px; font-weight: 700; letter-spacing: 2.4px; }
.main-nav { display: grid; gap: 6px; margin-top: 46px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 13px; padding: 12px 14px; border: 0; background: transparent; color: #b5cebe; cursor: pointer; text-align: left; }
.nav-item svg { width: 19px; }
.nav-item:hover { color: #fff; background: #20543b; }
.nav-item.active { color: #143c2b; background: #f3d476; font-weight: 700; box-shadow: 0 7px 20px rgba(0,0,0,.13); }
.sidebar-foot { display: grid; gap: 16px; margin-top: auto; }
.quality-note { display: flex; gap: 10px; padding: 13px 11px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.045); }
.quality-icon { color: #f2cf69; }
.quality-icon svg { width: 20px; }
.quality-note strong, .quality-note small, .profile strong, .profile small { display: block; }
.quality-note strong { font-size: 12px; }
.quality-note small { margin-top: 3px; color: #91ad9c; font-size: 10px; }
.profile { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; padding: 10px 6px; border: 0; background: transparent; color: #fff; text-align: left; cursor: pointer; }
.profile .avatar { display: grid; width: 34px; height: 34px; place-items: center; background: #e6efe9; color: var(--green-dark); font-size: 11px; font-weight: 800; }
.profile strong { font-size: 11px; }
.profile small { margin-top: 2px; color: #8cab98; font-size: 9px; }
.profile > svg { width: 15px; color: #8cab98; }
.main-content { min-height: 100vh; margin-left: var(--sidebar-width); overflow-x: hidden; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 24px; padding: 18px clamp(22px, 3vw, 48px); border-bottom: 1px solid var(--line); background: rgba(243,245,240,.93); backdrop-filter: blur(14px); }
.topbar-title { display: flex; align-items: center; gap: 12px; }
.topbar-title p { margin: 0 0 4px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: "Fraunces", serif; font-size: 24px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.search-box { display: flex; width: min(23vw, 270px); height: 42px; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line); background: var(--surface); }
.search-box:focus-within { border-color: var(--green); }
.search-box svg { width: 17px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::placeholder { color: #98a099; }
.icon-button, .primary-button, .secondary-button, .text-button { border: 0; cursor: pointer; }
.icon-button { position: relative; display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 1px solid var(--line); background: var(--surface); }
.icon-button svg { width: 18px; }
.notification-dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; border: 2px solid #fff; border-radius: 50%; background: var(--coral); }
.primary-button, .secondary-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; font-weight: 700; white-space: nowrap; }
.primary-button { background: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(23,107,69,.18); }
.primary-button:hover { background: var(--green-dark); }
.primary-button svg, .secondary-button svg { width: 17px; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); }
.secondary-button:hover { border-color: #aeb9b1; }
.menu-button { display: none; }
.view { display: none; padding: 32px clamp(22px, 3vw, 48px) 48px; animation: reveal .35s ease; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.section-heading, .page-intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h2, .page-intro h2 { margin-bottom: 4px; font-family: "Fraunces", serif; font-size: 27px; }
.section-heading p, .page-intro p, .panel-heading p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.shift-switch { display: flex; padding: 3px; border: 1px solid var(--line); background: #e9ede7; }
.shift-switch button { padding: 7px 11px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.shift-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 7px rgba(0,0,0,.07); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-top: 3px solid currentColor; background: var(--surface); box-shadow: 0 4px 16px rgba(24,35,29,.035); }
.metric-card.accent-green { color: var(--green); }.metric-card.accent-gold { color: #9a6c0a; }.metric-card.accent-blue { color: var(--blue); }.metric-card.accent-coral { color: var(--coral); }
.metric-top { display: flex; align-items: center; justify-content: space-between; }
.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; background: var(--green-soft); }
.accent-gold .metric-icon { background: var(--gold-soft); }.accent-blue .metric-icon { background: var(--blue-soft); }.accent-coral .metric-icon { background: var(--coral-soft); }
.metric-icon svg { width: 18px; }
.trend, .benchmark { display: inline-flex; align-items: center; gap: 3px; padding: 4px 6px; background: #edf5ef; color: var(--green); font-size: 10px; font-weight: 700; }
.trend svg { width: 12px; }
.benchmark { background: #f0f2ef; color: var(--muted); }
.metric-card > p { margin: 16px 0 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card > strong { display: block; overflow: hidden; color: var(--ink); font-family: "Fraunces", serif; font-size: 27px; white-space: nowrap; text-overflow: ellipsis; }
.metric-card > strong small { font: 600 14px "DM Sans", sans-serif; }
.metric-card > span { color: var(--muted); font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 16px; margin-top: 16px; }
.panel { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.collection-chart-panel { padding: 20px 22px 16px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-heading h3 { margin-bottom: 3px; font-family: "Fraunces", serif; font-size: 18px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; background: transparent; color: var(--green); font-size: 11px; font-weight: 700; }
.text-button svg { width: 14px; }
.chart-wrap { display: grid; grid-template-columns: 32px 1fr; height: 205px; margin-top: 17px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 22px; color: #9aa29c; font-size: 9px; }
.bar-chart { display: flex; align-items: end; justify-content: space-around; gap: 8px; padding: 0 6px 22px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, transparent calc(33.33% - 1px), #edf0ed 33.33%, transparent calc(33.33% + 1px), transparent calc(66.66% - 1px), #edf0ed 66.66%, transparent calc(66.66% + 1px)); }
.bar-group { position: relative; display: flex; height: 100%; flex: 1; align-items: end; justify-content: center; gap: 4px; }
.bar { width: min(14px, 32%); min-height: 4px; background: var(--green); transform-origin: bottom; animation: rise .65s ease both; }
.bar.evening { background: var(--gold); animation-delay: .08s; }
@keyframes rise { from { transform: scaleY(0); } }
.bar-label { position: absolute; bottom: -19px; color: var(--muted); font-size: 9px; font-weight: 600; }
.chart-legend { display: flex; justify-content: center; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 9px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; background: var(--green); }.legend-dot.evening { background: var(--gold); }
.farm-spotlight { position: relative; min-height: 290px; overflow: hidden; background: #254c36; color: #fff; }
.farm-spotlight img { width: 100%; height: 100%; object-fit: cover; }
.farm-spotlight::after { position: absolute; inset: 0; content: ""; background: linear-gradient(to top, rgba(8,32,20,.94) 3%, rgba(8,32,20,.12) 70%); }
.spotlight-overlay { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; padding: 18px; }
.live-badge { align-self: flex-start; padding: 5px 7px; background: rgba(12,35,23,.75); font-size: 8px; font-weight: 700; letter-spacing: .8px; backdrop-filter: blur(5px); }
.live-badge i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: #7ddb9e; }
.spotlight-overlay h3 { max-width: 260px; margin-bottom: 5px; font-family: "Fraunces", serif; font-size: 21px; }
.spotlight-overlay p { max-width: 270px; margin-bottom: 13px; color: #d4e3da; font-size: 11px; }
.temperature { display: inline-flex; align-self: flex-start; align-items: center; gap: 7px; padding: 8px 10px; background: rgba(255,255,255,.13); backdrop-filter: blur(6px); }
.temperature svg { width: 19px; color: #c9e4ee; }.temperature small, .temperature strong { display: block; }.temperature small { font-size: 7px; letter-spacing: .7px; }.temperature strong { margin-top: 1px; font-size: 13px; }
.recent-panel { margin-top: 16px; }
.recent-panel > .panel-heading, .data-panel > .panel-heading { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 10px 18px; border-bottom: 1px solid var(--line); background: #f7f8f6; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
td { padding: 12px 18px; border-bottom: 1px solid #edf0ed; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfa; }
.farmer-cell { display: flex; align-items: center; gap: 9px; }
.initials { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; background: var(--green-soft); color: var(--green-dark); font-size: 9px; font-weight: 800; }
.farmer-cell strong, .farmer-cell small { display: block; }.farmer-cell strong { font-size: 11px; }.farmer-cell small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; font-size: 9px; font-weight: 700; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.success { background: #e7f3ea; color: var(--green); }.status-pill.pending { background: var(--gold-soft); color: #88610e; }
.row-action { display: grid; width: 28px; height: 28px; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; }.row-action:hover { background: #edf1ed; }.row-action svg { width: 15px; }
.page-intro { padding: 8px 0 3px; }.eyebrow { display: block; margin-bottom: 6px; color: var(--green); font-size: 9px; font-weight: 800; letter-spacing: 1.3px; }
.record-count { color: var(--muted); font-size: 11px; }
.farmer-grid, .inventory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.farmer-card { padding: 20px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 5px 18px rgba(24,35,29,.04); }
.farmer-card-head { display: flex; align-items: center; gap: 12px; }
.farmer-card .initials { width: 42px; height: 42px; flex-basis: 42px; font-size: 12px; }
.farmer-card h3 { margin: 0 0 3px; font-family: "Fraunces", serif; font-size: 16px; }.farmer-card p { margin: 0; color: var(--muted); font-size: 10px; }
.farmer-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.farmer-card-stats span, .farmer-card-stats strong { display: block; }.farmer-card-stats span { color: var(--muted); font-size: 9px; }.farmer-card-stats strong { margin-top: 3px; font-size: 12px; }
.inventory-card { position: relative; overflow: hidden; padding: 21px; border: 1px solid var(--line); background: var(--surface); }
.inventory-icon { display: grid; width: 38px; height: 38px; place-items: center; background: var(--green-soft); color: var(--green); }.inventory-icon svg { width: 19px; }
.inventory-card h3 { margin: 20px 0 2px; font-family: "Fraunces", serif; font-size: 17px; }.inventory-card > p { color: var(--muted); font-size: 10px; }
.stock-line { display: flex; justify-content: space-between; margin: 18px 0 6px; font-size: 10px; }.stock-line strong { font-size: 11px; }
.progress { height: 6px; background: #e6ebe6; }.progress span { display: block; height: 100%; background: var(--green); }.inventory-card.low .progress span { background: var(--coral); }
.low-stock { position: absolute; top: 17px; right: 17px; color: var(--coral); font-size: 8px; font-weight: 800; letter-spacing: .7px; }
.payment-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.payment-summary div { padding: 20px; border-right: 1px solid var(--line); }.payment-summary div:last-child { border: 0; }
.payment-summary span, .payment-summary strong, .payment-summary small { display: block; }.payment-summary span { color: var(--muted); font-size: 10px; }.payment-summary strong { margin: 7px 0 4px; font-family: "Fraunces", serif; font-size: 21px; }.payment-summary small { color: var(--green); font-size: 9px; }
dialog { width: min(560px, calc(100vw - 28px)); padding: 0; border: 0; background: var(--surface); box-shadow: 0 25px 80px rgba(11,32,21,.3); }
dialog::backdrop { background: rgba(10,29,19,.58); backdrop-filter: blur(3px); }
dialog form { padding: 27px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; }.dialog-heading h2 { margin-bottom: 4px; font-family: "Fraunces", serif; }.dialog-heading p { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 24px; }.field { display: grid; gap: 6px; }.field.full { grid-column: 1 / -1; }.field span { font-size: 10px; font-weight: 700; }.field input, .field select { width: 100%; height: 43px; padding: 0 11px; border: 1px solid var(--line); border-radius: 0; outline: 0; background: #fafbf9; color: var(--ink); }.field input:focus, .field select:focus { border-color: var(--green); }
.calculated-amount { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; padding: 13px; background: var(--green-soft); color: var(--green-dark); }.calculated-amount span { font-size: 10px; font-weight: 700; }.calculated-amount strong { font-family: "Fraunces", serif; font-size: 19px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 9px; padding: 12px 16px; background: #163f2c; color: #fff; box-shadow: 0 12px 35px rgba(0,0,0,.2); font-size: 11px; font-weight: 600; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .25s ease; }.toast.show { opacity: 1; transform: none; }.toast svg { width: 17px; color: #f2cf69; }
.sidebar-backdrop { display: none; }.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .farmer-grid, .inventory-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }.farm-spotlight { min-height: 320px; }.farm-spotlight img { position: absolute; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }.sidebar.open { transform: none; }.sidebar-backdrop.open { position: fixed; inset: 0; z-index: 15; display: block; background: rgba(11,30,19,.5); }
  .main-content { margin-left: 0; }.menu-button { display: grid; }
  .topbar { min-height: 78px; padding: 13px 16px; }.topbar-title p { display: none; }.topbar-actions .search-box { display: none; }.topbar h1 { font-size: 20px; }
  .view { padding: 24px 16px 38px; }.metric-grid { gap: 10px; }.metric-card { padding: 15px; }.metric-card > strong { font-size: 23px; }
  .farmer-grid, .inventory-grid { grid-template-columns: 1fr; }.payment-summary { grid-template-columns: 1fr; }.payment-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) {
  .topbar-actions .icon-button { display: none; }.primary-button { padding: 0 12px; }.topbar-actions .primary-button span { display: none; }
  .section-heading, .page-intro { align-items: start; flex-direction: column; }.shift-switch { width: 100%; }.shift-switch button { flex: 1; }
  .metric-grid { grid-template-columns: 1fr; }.metric-card { display: grid; grid-template-columns: 1fr auto; }.metric-card .metric-top { grid-column: 1 / -1; }.metric-card > p { margin-bottom: 0; }.metric-card > strong { align-self: end; text-align: right; }.metric-card > span { grid-column: 1 / -1; margin-top: 4px; }
  .collection-chart-panel { padding-inline: 14px; }.farm-spotlight { min-height: 290px; }.recent-panel > .panel-heading, .data-panel > .panel-heading { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }.field.full { grid-column: auto; }dialog form { padding: 21px; }
}