:root {
  --ink: #171a19;
  --ink-2: #222624;
  --paper: #f3f4f0;
  --panel: #ffffff;
  --panel-soft: #eceee9;
  --line: #d7dbd5;
  --line-dark: #c5cac3;
  --muted: #707770;
  --muted-2: #929892;

  --accent: #d7e84a;
  --accent-dark: #aebf20;

  --green: #3f8f63;
  --green-soft: #edf5ee;

  --orange: #bd8233;
  --orange-soft: #faf3e7;

  --red: #b95b53;
  --red-soft: #faeeee;

  --sidebar: 228px;
  --radius: 2px;

  --font:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --mono:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

::selection {
  background: var(--accent);
  color: var(--ink);
}

/* =========================================================
   APP SHELL
========================================================= */

.app {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
  width: var(--sidebar);
  height: 100%;
  flex: 0 0 var(--sidebar);
  display: flex;
  flex-direction: column;
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
}

.brand {
  height: 76px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-right: 11px;
  background: var(--ink);
  color: var(--accent);
}

.brand-name {
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .18em;
}

.brand-subtitle {
  margin-top: 5px;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--muted);
}

.farm-selector {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-label {
  margin: 0 0 9px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--muted);
}

.farm-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
}

.farm-name {
  font-size: 12px;
  font-weight: 700;
}

.farm-location {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
}

.sidebar-nav {
  flex: 1;
  padding: 17px 16px;
  overflow: auto;
}

.nav-group {
  margin-bottom: 28px;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 39px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  margin-bottom: 2px;
  background: transparent;
  color: #535a54;
  text-align: left;
  transition: .18s ease;
}

.nav-item:hover {
  background: #e4e7e1;
}

.nav-item.active {
  background: var(--ink);
  color: #fff;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  background: var(--accent);
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: grid;
  place-items: center;
  color: #777e77;
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.nav-label {
  font-size: 12px;
  font-weight: 600;
}

.sidebar-user {
  padding: 15px 16px;
  border-top: 1px solid var(--line);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  background: var(--ink);
  color: white;
  font-size: 10px;
  font-weight: 800;
}

.user-info {
  min-width: 0;
}

.user-name {
  font-size: 11px;
  font-weight: 700;
}

.user-role {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.user-menu {
  margin-left: auto;
  color: var(--muted);
  background: transparent;
}

/* =========================================================
   MAIN
========================================================= */

.main {
  min-width: 0;
  flex: 1;
  height: 100%;
  overflow: auto;
  background: var(--paper);
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}

.date {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-title {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.035em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-button {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.content {
  padding: 30px 32px 48px;
  max-width: 1800px;
  margin: auto;
}

/* =========================================================
   GRID
========================================================= */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(580px, 1.55fr) minmax(360px, 1fr);
  gap: 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(580px, 1.55fr) minmax(360px, 1fr);
  gap: 18px;
}

/* =========================================================
   PANELS
========================================================= */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
}

.panel-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-title {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.02em;
}

/* =========================================================
   SITUATION HERO
========================================================= */

.situation {
  overflow: hidden;
  background: var(--ink);
  color: white;
  border: 1px solid var(--ink);
}

.situation-header {
  min-height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.situation .eyebrow {
  color: rgba(255,255,255,.42);
}

.situation-title {
  margin-top: 7px;
  font-size: 15px;
  font-weight: 600;
}

.sync {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: rgba(255,255,255,.48);
}

.sync .status-dot {
  background: var(--accent);
}

.situation-body {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: 246px;
}

.score {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 25px;
  border-right: 1px solid rgba(255,255,255,.1);
}

.score-number {
  font-family: var(--mono);
  font-size: 72px;
  line-height: .9;
  letter-spacing: -.09em;
  color: var(--accent);
}

.score-label {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  font-size: 11px;
  color: rgba(255,255,255,.45);
}

.progress {
  height: 3px;
  background: rgba(255,255,255,.11);
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.situation-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.situation-metric {
  padding: 25px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.situation-metric:nth-child(odd) {
  border-right: 1px solid rgba(255,255,255,.1);
}

.situation-metric:nth-child(3),
.situation-metric:nth-child(4) {
  border-bottom: 0;
}

.metric-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

.metric-number {
  margin-top: 13px;
  font-family: var(--mono);
  font-size: 27px;
  line-height: 1;
  letter-spacing: -.05em;
}

.metric-meta {
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255,255,255,.43);
}

.metric-positive {
  color: var(--accent);
}

/* =========================================================
   DECISION
========================================================= */

.decision-body {
  padding: 24px;
}

.decision-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.decision-culture {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.decision-price {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 29px;
  line-height: 1;
  letter-spacing: -.05em;
}

.decision-threshold {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.decision-change {
  padding: 6px 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.mini-chart {
  height: 66px;
  margin-top: 18px;
}

.mini-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: drawChart 1.4s ease forwards;
}

@keyframes drawChart {
  to {
    stroke-dashoffset: 0;
  }
}

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.primary-action {
  width: 100%;
  height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 21px;
  padding: 0 14px;
  background: var(--accent);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  transition: .15s ease;
}

.primary-action:hover {
  background: #c7d83b;
  transform: translateY(-1px);
}

/* =========================================================
   KPI STRIP
========================================================= */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.kpi {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: .18s ease;
}

.kpi:hover {
  border-color: var(--line-dark);
  transform: translateY(-1px);
}

.kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-change {
  font-size: 11px;
  font-weight: 700;
}

.positive {
  color: var(--green);
}

.attention {
  color: var(--orange);
}

.kpi-value {
  margin-top: 17px;
  font-family: var(--mono);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.06em;
}

.kpi-meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* =========================================================
   PERFORMANCE
========================================================= */

.section-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(580px, 1.55fr) minmax(360px, 1fr);
  gap: 18px;
}

.performance-body {
  padding: 21px 22px 19px;
}

.table-head,
.crop-row {
  display: grid;
  grid-template-columns: 125px 1fr 100px;
  align-items: center;
  gap: 16px;
}

.table-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.crop-list {
  padding-top: 18px;
}

.crop-row {
  margin-bottom: 20px;
}

.crop-name {
  font-size: 11px;
  font-weight: 700;
}

.crop-area {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.bar {
  height: 8px;
  background: #e9ece7;
}

.bar span {
  display: block;
  height: 100%;
}

.bar.green span {
  background: var(--green);
}

.bar.orange span {
  background: var(--orange);
}

.bar.neutral span {
  background: #aeb4ae;
}

.crop-value {
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
}

.performance-foot {
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

/* =========================================================
   WEATHER
========================================================= */

.weather-body {
  padding: 21px 22px;
}

.weather-current {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--line);
}

.temperature {
  font-family: var(--mono);
  font-size: 42px;
  line-height: .9;
  letter-spacing: -.07em;
}

.weather-location {
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}

.weather-rain {
  text-align: right;
}

.weather-rain strong {
  display: block;
  font-size: 12px;
}

.weather-rain span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.forecast {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding-top: 18px;
}

.forecast-day {
  text-align: center;
}

.forecast-day-name {
  font-size: 11px;
  color: var(--muted);
}

.forecast-temp {
  margin-top: 11px;
  font-size: 11px;
  font-weight: 600;
}

.weather-dot {
  width: 6px;
  height: 6px;
  margin: 10px auto 0;
  border-radius: 50%;
}

.weather-dot.green {
  background: var(--green);
}

.weather-dot.orange {
  background: var(--orange);
}

.rain {
  margin-top: 7px;
  font-size: 11px;
  color: var(--muted);
}

.weather-alert {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding: 11px 13px;
  background: var(--orange-soft);
  border-left: 2px solid var(--orange);
  font-size: 11px;
  line-height: 1.5;
}

.weather-alert strong {
  font-weight: 800;
}

/* =========================================================
   TIMELINE
========================================================= */

.timeline {
  margin-top: 18px;
}

.timeline-body {
  padding: 27px 25px 30px;
}

.timeline-track {
  position: relative;
}

.timeline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 27px;
  height: 1px;
  background: var(--line);
}

.timeline-items {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}

.timeline-item {
  min-width: 0;
}

.timeline-date {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.timeline-node {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  margin-top: 9px;
  background: var(--ink);
}

.timeline-node span {
  width: 5px;
  height: 5px;
  background: var(--accent);
}

.timeline-node.current {
  background: var(--accent);
}

.timeline-node.current span {
  background: var(--ink);
}

.timeline-node.future {
  background: var(--panel);
  border: 1px solid var(--line);
}

.timeline-node.future span {
  background: var(--line);
}

.timeline-title {
  margin-top: 10px;
  font-size: 10px;
  font-weight: 700;
}

.timeline-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

/* =========================================================
   TOAST
========================================================= */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 18px;
  background: var(--ink);
  color: white;
  font-size: 10px;
  font-weight: 600;
  box-shadow: 0 15px 35px rgba(0,0,0,.15);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .25s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   ANIMATIONS
========================================================= */

.fade {
  opacity: 0;
  transform: translateY(7px);
  animation: appear .45s ease forwards;
}

.fade:nth-child(2) {
  animation-delay: .05s;
}

.fade:nth-child(3) {
  animation-delay: .1s;
}

@keyframes appear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   RESPONSIVE
   Desktop-first. Compact layout only below 1100px.
========================================================= */

@media (max-width: 1250px) {
  .content {
    padding: 24px;
  }

  .hero-grid,
  .section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 72px;
    flex-basis: 72px;
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand-text,
  .farm-selector,
  .section-label,
  .nav-label,
  .sidebar-user .user-info,
  .user-menu {
    display: none;
  }

  .brand-mark {
    margin: 0;
  }

  .sidebar-nav {
    padding: 15px 10px;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .sidebar-user {
    display: flex;
    justify-content: center;
  }

  .user-avatar {
    margin: 0;
  }

  .topbar {
    padding: 0 20px;
  }

  .content {
    padding: 20px;
  }
}

@media (max-width: 700px) {
  body {
    overflow: auto;
  }

  .app {
    min-height: 100vh;
    height: auto;
  }

  .sidebar {
    display: none;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .topbar {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    gap: 16px;
  }

  .top-actions {
    display: none;
  }

  .content {
    padding: 18px;
  }

  .situation-body {
    grid-template-columns: 1fr;
  }

  .score {
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-items {
    min-width: 850px;
  }

  .timeline-body {
    overflow-x: auto;
  }
}
