@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #f2f5ef;
  --surface: #ffffff;
  --ink: #1d241f;
  --muted: #5b6b5f;
  --accent: #2f7d32;
  --accent-soft: #e6f2e6;
  --accent-2: #6bb36f;
  --shadow: 0 8px 24px rgba(24, 36, 24, 0.08);
  --shadow-soft: 0 6px 16px rgba(24, 36, 24, 0.06);
  --radius: 12px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --font-heading: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
  --font-body: "Inter", "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: #f7f8fa;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/static/logo-ksip.png") center / clamp(280px, 38vw, 520px) no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: -1;
}

.login-body {
  background: radial-gradient(circle at top, #eef3ea, #f7f8fa);
  min-height: 100vh;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: 0 18px 40px rgba(31, 41, 55, 0.08);
  border: 1px solid #e5e7eb;
}

.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  text-align: center;
}

.login-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
}

.login-brand {
  font-weight: 800;
  color: #0f6b34;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1rem;
  padding: 6px 16px;
  border-radius: 999px;
  background: #eaf4ea;
  border: 1px solid #cfe3cf;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.form-error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.button-primary.full {
  width: 100%;
}

.help-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
}

.help-button {
  background: #2f7d32;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(16, 24, 16, 0.2);
  cursor: pointer;
  font-weight: 600;
}

.help-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(320px, 90vw);
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 16px 32px rgba(16, 24, 16, 0.16);
  display: none;
}

.help-panel.open {
  display: block;
}

.help-panel h4 {
  margin: 0 0 6px 0;
  font-size: 1rem;
}

.help-panel p {
  margin: 0 0 12px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.help-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 10px;
  font-family: inherit;
  font-size: 0.9rem;
}

.help-panel .help-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

h1, h2, h3 { font-family: var(--font-heading); }

.nav .link,
.card-title h2,
.data-table thead th,
.matrix-table thead th {
  font-family: var(--font-heading);
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
  min-width: 0;
}

.section {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.section + .section {
  margin-top: var(--space-4);
}

.header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.header-split {
  align-items: flex-start;
}

.header-right {
  display: grid;
  gap: var(--space-2);
  justify-items: end;
  min-width: 360px;
}

.compact-card {
  padding: var(--space-2);
  width: 100%;
  max-width: 520px;
}

.eyebrow {
  margin: 0 0 var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--muted);
}

.header h1 {
  margin: 0 0 var(--space-1);
  font-size: 2.2rem;
  letter-spacing: 0.02em;
}

.header p { margin: 0; color: var(--muted); }

.nav {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.link,
button,
.action-btn {
  font: inherit;
  border: none;
  text-decoration: none;
  cursor: pointer;
}

.nav .link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.nav .link i {
  font-size: 0.88rem;
  opacity: 0.9;
}

.nav .link.ghost {
  background: var(--accent);
  color: #fff;
}

.muted { color: var(--muted); }

.card {
  background: var(--surface);
  padding: var(--space-3);
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
  max-width: 100%;
  min-width: 0;
}

.card-header {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.card-header.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card-title h2 { margin: 0; }

.wide {
  grid-column: 1 / -1;
  min-width: 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.badge-pemberian_benih {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
}

.badge-tanam_benih {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.badge-pemupukan,
.badge-penyiraman {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.badge-pengendalian_hama {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

.badge-panen {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.dashboard-hero {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.card-grid-wrap {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius);
  background: #f7f9f4;
  box-shadow: var(--shadow-soft);
}

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef6f0;
  color: var(--accent);
  font-size: 0.9rem;
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: var(--space-1);
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.area-summary-divider {
  height: 1px;
  margin: 24px 0 18px;
  background: linear-gradient(90deg, transparent, var(--ui-border-strong), transparent);
}

.area-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 14px;
}

.area-summary-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
}

.area-summary-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.area-summary-filter-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 999px;
  color: #285b32;
  background: #f5faf5;
  font-size: 0.78rem;
  font-weight: 700;
}

.area-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--space-3);
}

.area-pie-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #fafcf9);
}

.area-pie-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 750;
}

.area-pie-title strong {
  padding: 3px 8px;
  border-radius: 999px;
  color: #2f7d32;
  background: #eaf6ea;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.area-pie-canvas {
  position: relative;
  height: 280px;
  margin-top: 8px;
}

.area-pie-empty,
.area-summary-empty {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 16px;
  border: 1px dashed var(--ui-border-strong);
  border-radius: 12px;
  color: var(--muted);
  background: var(--ui-surface-soft);
  font-size: 0.9rem;
  text-align: center;
}

.area-summary-empty {
  min-height: 100px;
}

.kpi-card {
  background: linear-gradient(180deg, #ffffff 0%, #f9fbf6 100%);
  border: 1px solid rgba(33, 61, 33, 0.08);
  border-radius: var(--radius);
  padding: var(--space-3);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2);
  align-items: center;
  box-shadow: 0 10px 30px rgba(24, 36, 24, 0.06);
}

.kpi-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

.kpi-text {
  display: grid;
  gap: 4px;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: #fff;
}

.kpi-people { background: linear-gradient(135deg, #1f7a3d, #41a34e); }
.kpi-box { background: linear-gradient(135deg, #6b8e23, #a3c54a); }
.kpi-seed { background: linear-gradient(135deg, #15803d, #34d399); }
.kpi-growth { background: linear-gradient(135deg, #0f766e, #34d399); }
.kpi-actual { background: linear-gradient(135deg, #1d4ed8, #60a5fa); }
.kpi-achieve { background: linear-gradient(135deg, #a16207, #f59e0b); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.carousel-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.carousel-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.carousel-status {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 6px;
  font-weight: 600;
}

.carousel-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: var(--space-2);
  font-weight: 600;
}

.chart-carousel {
  overflow: hidden;
}

.carousel-track {
  display: flex;
  gap: var(--space-3);
  transition: transform 0.3s ease;
}

.chart-carousel .chart-card {
  flex: 0 0 calc((100% - (var(--space-3) * 3)) / 4);
}

@media (max-width: 1100px) {
  .chart-carousel .chart-card {
    flex-basis: calc((100% - (var(--space-3) * 2)) / 3);
  }
}

@media (max-width: 900px) {
  .chart-carousel .chart-card {
    flex-basis: calc((100% - var(--space-3)) / 2);
  }
}

@media (max-width: 640px) {
  .chart-carousel .chart-card {
    flex-basis: 100%;
  }
}

.chart-card {
  border: 1px solid rgba(33, 61, 33, 0.08);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: #fbfbf7;
  display: grid;
  gap: var(--space-2);
}

.chart-canvas {
  height: 240px;
}

.chart-canvas.large {
  height: 320px;
}

.chart-scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-scroll-x canvas {
  display: block;
  max-width: none !important;
}

.chart-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.mitra-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

@media (max-width: 900px) {
  .mitra-page-grid {
    grid-template-columns: 1fr;
  }
}

.field-inline {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.field-inline.compact {
  gap: 8px;
  justify-content: flex-end;
}

.filter-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.filter-inline .mini-label {
  margin: 0;
}

.filter-inline .select-compact {
  min-width: 160px;
}

.filter-inline .button-primary {
  width: auto;
}

.select-compact {
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(33, 61, 33, 0.12);
  background: #fff;
  font-weight: 600;
}

.btn-compact {
  padding: 8px 14px;
  border-radius: 999px;
}

.field-inline.compact .button-primary {
  width: auto;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.kpi-filter {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
}

.kpi-filter-field {
  display: grid;
  gap: 6px;
}

.bar-chart {
  display: grid;
  gap: var(--space-2);
}

.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 120px;
  gap: var(--space-2);
  align-items: center;
}

.bar-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.bar-stack {
  position: relative;
  height: 10px;
  background: #eef2ea;
  border-radius: 999px;
  overflow: hidden;
}

.bar-stack.single {
  height: 12px;
}

.bar {
  position: absolute;
  height: 100%;
  left: 0;
  top: 0;
}

.bar-est {
  background: #8aa86b;
  opacity: 0.6;
}

.bar-act {
  background: #2f7d2f;
}

.bar-dist {
  background: #2f7d2f;
}

.bar-value {
  font-size: 0.8rem;
  color: var(--text);
  text-align: right;
}

.chart-legend {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: 0.85rem;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
}

.legend-dot.est { background: #8aa86b; }
.legend-dot.act { background: #2f7d2f; }

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.data-table thead th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  background: #f8faf6;
  border-bottom: 2px solid #cbd5e1;
  border-right: 1px solid #d1d5db;
}

.data-table thead th:last-child {
  border-right: none;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #d1d5db;
  border-right: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.data-table tbody td:last-child {
  border-right: none;
}

.data-table tbody tr:hover {
  background: #f9fbf6;
}

.cell-ok {
  background: rgba(34, 197, 94, 0.12);
  font-weight: 600;
}

.cell-bad {
  background: rgba(239, 68, 68, 0.12);
  font-weight: 600;
}

.matrix-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
}

.matrix-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  --matrix-col1-width: 280px;
  --matrix-col2-width: 160px;
}

.matrix-table thead th {
  background: #0f6b34;
  color: #fff;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 10px 12px;
  border: 1px solid #0b5a2b;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}

.matrix-table tbody td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: center;
  font-size: 0.85rem;
  white-space: nowrap;
}

.matrix-table tbody td.label-cell {
  text-align: left;
  font-weight: 600;
  white-space: normal;
}

.matrix-table .sticky-col-1 {
  position: sticky;
  left: 0;
  min-width: var(--matrix-col1-width);
  max-width: var(--matrix-col1-width);
  z-index: 4;
}

.matrix-table .sticky-col-2 {
  position: sticky;
  left: var(--matrix-col1-width);
  min-width: var(--matrix-col2-width);
  max-width: var(--matrix-col2-width);
  z-index: 4;
}

.matrix-table thead .sticky-col-1,
.matrix-table thead .sticky-col-2 {
  z-index: 6;
}

.row-plan .sticky-col-1,
.row-plan .sticky-col-2 {
  background: #f3f4f6;
}

.row-forecast .sticky-col-2 {
  background: #e0f2fe;
}

.row-actual .sticky-col-2 {
  background: #dcfce7;
}

.matrix-summary .sticky-col-1,
.matrix-summary .sticky-col-2 {
  background: #f8faf6;
}

.mitra-name-cell .mitra-name-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  max-height: calc(1.25em * 3);
}

.row-plan td {
  background: #f3f4f6;
}

.row-forecast td {
  background: #e0f2fe;
}

.matrix-table td.actual-alert {
  background: #fee2e2 !important;
  color: #991b1b;
  font-weight: 700;
}

.row-actual td {
  background: #dcfce7;
}

.matrix-table td.actual-editable {
  cursor: text;
  outline: none;
  transition: box-shadow 0.15s ease, background-color 0.15s ease;
}

.matrix-table td.actual-editable:focus {
  background: #bbf7d0;
  box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.45);
}

.matrix-table td.actual-editable.is-saving {
  background: #fef9c3;
}

.matrix-table td.actual-editable.is-error {
  background: #fee2e2;
}

.matrix-summary td {
  background: #f8faf6;
  font-weight: 700;
}

.matrix-week-header td {
  background: #edf7ef;
  font-weight: 700;
}

.supply-chart-wrap {
  margin-top: 16px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  height: 320px;
}

.map-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.map-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.map-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.map-box {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
}

.recommend-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.recommend-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.recommend-box h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.recommend-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.recommend-metrics span {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
}

.recommend-metrics strong {
  font-size: 1.05rem;
  color: #111827;
}

.recommend-badges .badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
}
.recommend-badges .badge.risk-tinggi {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}
.recommend-badges .badge.risk-sedang {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}
.recommend-badges .badge.risk-rendah {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.recommend-list {
  padding-left: 18px;
  margin: 0;
  color: #111827;
}

.recommend-list li {
  margin-bottom: 8px;
}

.recommend-group {
  margin-bottom: 12px;
}

.recommend-group strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.recommend-group ul {
  margin: 0;
  padding-left: 18px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  align-items: end;
}

.global-filter {
  margin: var(--space-3) 0 var(--space-4);
  grid-template-columns: 1fr auto;
}

.global-filter button {
  height: 42px;
}

.list-search {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 16px;
}

.list-search .filter-actions {
  grid-column: auto;
  justify-self: end;
}

.timeline-filter-bar {
  grid-template-columns: repeat(2, minmax(220px, 320px));
  justify-content: start;
  margin-bottom: var(--space-2);
}

.filter-bar label,
.form label {
  display: grid;
  gap: var(--space-1);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  border: none;
  background: #f3f5f0;
  box-shadow: inset 0 0 0 1px rgba(33, 61, 33, 0.08);
  font-size: 0.95rem;
  color: var(--ink);
}

textarea { resize: vertical; }

.filter-actions {
  display: flex;
  gap: var(--space-1);
  justify-self: end;
  align-self: end;
  grid-column: 1 / -1;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.link.ghost {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

button.ghost {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.period-field { display: none; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-2);
}

.grid-card {
  background: #f9faf6;
  border-radius: var(--radius);
  padding: var(--space-2);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.grid-card-header strong { font-size: 1.05rem; }

.grid-card-header .muted { font-size: 0.85rem; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(47, 125, 50, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
  width: fit-content;
}

.grid-card-body div {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--muted);
}

.grid-card-body strong { color: var(--ink); }

.mini-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(47, 125, 50, 0.12);
  overflow: hidden;
  margin-top: var(--space-1);
}

.mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(47, 125, 50, 0.12);
  overflow: hidden;
  margin-top: var(--space-1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1b5e20, #66bb6a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
}

.stok-chart {
  display: grid;
  gap: var(--space-2);
}

.stok-bar {
  display: grid;
  gap: 6px;
}

.stok-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.stok-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(47, 125, 50, 0.12);
  overflow: hidden;
}

.stok-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f7d32, #8bc34a);
}

.stok-fill.masuk {
  background: linear-gradient(90deg, #1b5e20, #7cb342);
}

.stok-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.simple-table {
  overflow-x: hidden;
}

.simple-table .table-row {
  grid-template-columns: 1.2fr 1fr 1fr 1fr 1.4fr;
}

.simple-table .table-row.header {
  font-size: 0.72rem;
}


.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
}

.dashboard-main {
  display: grid;
  gap: var(--space-4);
}

.dashboard-sidebar {
  position: relative;
}

.sticky-card {
  position: sticky;
  top: 24px;
}

.sidebar-filter {
  grid-template-columns: 1fr;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.card-footer {
  margin-top: var(--space-2);
  display: flex;
  justify-content: flex-end;
}

.card-highlight {
  background: linear-gradient(160deg, #ffffff 0%, #f6f8f3 100%);
}

.form {
  display: grid;
  gap: var(--space-3);
}

.form-section {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: #f7f9f4;
  box-shadow: var(--shadow-soft);
}

.form-section-header {
  display: grid;
  gap: var(--space-1);
}

.form-section-header h3 { margin: 0; font-size: 1.05rem; }

.form-grid {
  display: grid;
  gap: var(--space-2) var(--space-3);
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 { grid-column: span 2; }

.field-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-1);
  align-items: center;
}

.form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin: 0 calc(var(--space-3) * -1) calc(var(--space-3) * -1);
  background: var(--surface);
  box-shadow: 0 -8px 24px rgba(24, 36, 24, 0.08);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }

.hint.warn { color: #9c6b1a; }

.mini-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.table {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  overflow-x: auto;
}

.table-row {
  display: grid;
  grid-template-columns: 120px 160px 1.4fr 120px 110px 110px 110px 220px;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(33, 61, 33, 0.08);
  align-items: center;
}

.konversi-table .table-row {
  grid-template-columns: 120px 200px 90px 90px 160px 160px 160px;
}

.konversi-table .table-row.header {
  font-size: 0.68rem;
}

.konversi-table .actions-col {
  gap: 8px;
}

.benih-table .table-row {
  grid-template-columns: 120px 160px 140px 1.4fr 160px 200px;
}

.benih-table .table-row.header {
  font-size: 0.68rem;
}

.benih-table .actions-col {
  gap: 8px;
  justify-content: flex-start;
}

.table-row.header {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.table-row .actions-col {
  justify-content: flex-start;
}

.table-row .actions-col .action-btn {
  min-width: 120px;
}

.list-table .table-row {
  grid-template-columns:
    minmax(80px, 0.9fr)
    minmax(120px, 1.1fr)
    minmax(170px, 1.6fr)
    minmax(90px, 0.9fr)
    minmax(95px, 0.95fr)
    minmax(95px, 0.95fr)
    minmax(80px, 0.85fr)
    minmax(95px, 0.95fr)
    minmax(75px, 0.75fr)
    minmax(120px, 1fr) !important;
  gap: 8px;
  padding: 14px 16px;
  align-items: start;
}

.list-table .table-row.header {
  font-size: 0.68rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8faf8;
  border-bottom: 1px solid #dfe7df;
  align-items: center;
}

.list-table .cell {
  align-self: start;
  display: block;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  word-break: normal;
}

.list-table .actions-col {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.list-table .actions-col .action-btn {
  min-width: 88px;
  justify-content: flex-start;
}

.list-table .table-row.header .cell {
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.list-table .table-row .cell:nth-child(4),
.list-table .table-row .cell:nth-child(5),
.list-table .table-row .cell:nth-child(6),
.list-table .table-row .cell:nth-child(8),
.list-table .table-row .cell:nth-child(9) {
  white-space: normal;
}

.list-table .table-row .cell:nth-child(3) {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.list-table .table-row .cell:nth-child(5),
.list-table .table-row .cell:nth-child(6) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-table .table-row .cell:nth-child(5),
.list-table .table-row .cell:nth-child(6),
.list-table .table-row .cell:nth-child(8) {
  font-variant-numeric: tabular-nums;
}

.list-table .table-row .cell:nth-child(10) {
  overflow: visible;
}

.list-name {
  line-height: 1.25;
  display: inline-block;
}

.list-lokasi {
  line-height: 1.25;
  display: inline-block;
}

.list-sub-petani {
  line-height: 1.35;
  display: inline-block;
}

.list-table {
  gap: 0;
  border: 1px solid #dfe7df;
  border-radius: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ffffff;
}

.list-table .table-row:not(.header):hover {
  background: #fbfdfb;
}

.list-table .empty {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.cell small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.cell-emphasis strong {
  color: var(--accent);
}

.badge-selisih { color: var(--accent); }

.actions-col {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: center;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  font-weight: 600;
  cursor: pointer;
}

.file-btn input[type="file"] {
  display: none;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  background: #f1f4ef;
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-soft);
}

.action-btn i { font-size: 0.95rem; }

.action-btn.danger { background: #fbeeed; color: #9b2c2c; }

.btn-icon { font-size: 1rem; }

.empty { padding: var(--space-3) 0; color: var(--muted); }

.row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(33, 61, 33, 0.08);
  align-items: center;
}

.row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.row.header {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.row span small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.field-hidden {
  display: none;
}

/* Schedule page support */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.stat {
  padding: var(--space-2);
  border-radius: var(--radius);
  background: #f7f9f4;
  box-shadow: var(--shadow-soft);
}

.stat span { display: block; color: var(--muted); font-size: 0.85rem; margin-bottom: var(--space-1); }

.yield-bar { display: grid; gap: var(--space-1); }

.yield-bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(47, 125, 50, 0.12);
  overflow: hidden;
}

.yield-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.yield-bar-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline {
  position: relative;
  display: grid;
  gap: var(--space-3);
}

.timeline-line {
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(33, 61, 33, 0.12);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: var(--space-2);
}

.timeline-item .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: var(--space-1);
}

.timeline-item.timeline-pemberian_benih .dot { background: #2563eb; }
.timeline-item.timeline-tanam_benih .dot { background: #16a34a; }
.timeline-item.timeline-pemupukan .dot { background: #f59e0b; }
.timeline-item.timeline-penyiraman .dot { background: #d97706; }
.timeline-item.timeline-pengendalian_hama .dot { background: #dc2626; }
.timeline-item.timeline-panen .dot { background: #059669; }

.timeline-card {
  background: #f9faf6;
  border-radius: var(--radius);
  padding: var(--space-2);
  box-shadow: var(--shadow-soft);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.timeline-metrics {
  display: grid;
  gap: var(--space-1);
  color: var(--muted);
  font-size: 0.85rem;
}

.signature-box {
  border: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: #f7f9f4;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.signature-line { margin-top: var(--space-1); font-weight: 600; letter-spacing: 0.08em; }

.export-area {
  position: fixed;
  left: -20000px;
  top: 0;
  width: 794px;
  padding: 24px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.export-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: 16px;
}

.export-logo {
  width: 56px;
  height: auto;
}

.export-meta {
  display: grid;
  gap: var(--space-1);
  color: var(--muted);
  font-size: 0.8rem;
}

.export-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  margin-bottom: 16px;
}

.export-stats > div {
  background: #f7f9f4;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  font-size: 0.85rem;
}

.export-timeline {
  display: grid;
  gap: 12px;
}

.export-footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 0.8rem;
}

.export-area h1 {
  font-size: 1.1rem;
  margin: 0 0 4px;
}

.export-area p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.export-area .timeline-metrics {
  font-size: 0.78rem;
  gap: 6px;
}

@media (max-width: 980px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .activity-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
  }

  .dashboard-hero {
    grid-template-columns: 1fr;
  }

  .card-grid-wrap {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .span-2 { grid-column: span 1; }

  .table-row {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    padding: var(--space-2);
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  .list-table .table-row {
    grid-template-columns: 1fr 1fr !important;
    padding: var(--space-2);
  }

  .table-row.header { display: none; }

  .cell {
    display: grid;
    gap: var(--space-1);
  }

  .cell::before {
    content: attr(data-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: var(--muted);
  }

  .actions-col {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .action-btn {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: var(--radius);
  }

  .btn-text { display: none; }
}

@media (max-width: 680px) {
  .shell { padding: var(--space-3) var(--space-2); }
  .header h1 { font-size: 1.8rem; }
  body::before {
    background-size: clamp(220px, 60vw, 360px);
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 80px 1fr 90px;
  }
}

/* ==== v20260222: list cards + activity board ==== */
.petani-card-filter {
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.petani-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfb;
}

.petani-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: start;
  text-decoration: none;
  color: inherit;
  border: 1.5px solid #c9d3cb;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(21, 43, 31, 0.05);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.petani-card-head {
  border: 0;
  background: transparent;
  width: 100%;
  grid-column: 1 / -1;
  padding: 0;
  text-align: left;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: start;
  cursor: pointer;
}

.petani-card:hover {
  border-color: #7ea084;
  box-shadow: 0 6px 14px rgba(21, 43, 31, 0.08);
  transform: translateY(-1px);
}

.petani-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1f8a3c, #0d6d2d);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
}

.petani-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-right: 10px;
}

.petani-main strong {
  font-size: 1.02rem;
  line-height: 1.2;
}

.petani-main span,
.petani-main small {
  color: var(--muted);
  line-height: 1.25;
}

.petani-meta {
  display: grid;
  gap: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 0.86rem;
  border-left: 1px solid var(--line);
  padding-left: 12px;
  min-width: 130px;
}

.petani-meta span,
.petani-meta small {
  display: block;
  padding: 3px 0;
  border-top: 1px dashed #d8dfd9;
}

.petani-meta > :first-child {
  border-top: none;
}

.petani-actions-panel {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: none;
  gap: 8px;
  grid-template-columns: 1fr;
}

.petani-card.open .petani-actions-panel {
  display: grid;
}

.petani-actions-panel .action-btn {
  width: 100%;
  justify-content: flex-start;
  border-radius: 10px;
}

.petani-actions-panel form {
  margin: 0;
}

.petani-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.petani-pager .action-btn {
  min-width: 40px;
  justify-content: center;
}

.petani-pager .action-btn.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pager-info {
  font-weight: 700;
  color: var(--muted);
  min-width: 84px;
  text-align: center;
}

.empty-centered { text-align: center; }
.notice-warn {
  border: 1px solid #f59e0b;
  background: #fff7e8;
  color: #7a4a00;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.notice-warn p {
  margin: 6px 0 0;
}

.stat-grid-tight .stat { min-height: 84px; }

.schedule-panel-filter {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.activity-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  min-height: 290px;
  display: grid;
  grid-template-rows: auto 1fr;
}

.activity-panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.activity-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}

.activity-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fcfdfc;
}

.activity-line {
  font-size: 0.92rem;
  line-height: 1.35;
}

.activity-item .actions-col {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.activity-item .actions-col form { margin: 0; }

.activity-empty { margin-top: 10px; }

@media (max-width: 980px) {
  .activity-grid { grid-template-columns: 1fr; }
  .petani-card { grid-template-columns: 1fr; }
  .petani-card-head { grid-template-columns: 44px 1fr; }
  .petani-meta {
    grid-column: 1 / -1;
    text-align: left;
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 8px;
  }
}

/* ==== v20260219: UI hardening desktop/tablet/mobile ==== */
:root {
  --line-strong: #c9d3cb;
  --line-soft: #e3e8e3;
}

h1 { font-size: clamp(1.8rem, 2.2vw, 2.75rem); line-height: 1.14; margin: 0; }
h2 { font-size: clamp(1.26rem, 1.45vw, 1.7rem); line-height: 1.2; margin: 0; }
h3 { font-size: clamp(1.04rem, 1.1vw, 1.22rem); line-height: 1.25; margin: 0; }

.shell {
  max-width: min(1360px, calc(100vw - 48px));
}

.section {
  margin-top: 22px;
}

.card {
  border: 1px solid var(--line-soft);
  box-shadow: 0 8px 18px rgba(21, 43, 31, 0.055);
}

.card-title,
.card-header {
  margin-bottom: 14px;
}

.card-title > div p,
.card-header > p,
.muted {
  color: #5f6f63;
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.nav .link {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #e2e8e3;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(19, 38, 24, 0.06);
}

.nav .link.ghost {
  border-color: transparent;
}

.nav .link:focus-visible,
.action-btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(46, 125, 50, 0.22);
  outline-offset: 1px;
}

.filter-bar {
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fbfcfb;
}

.filter-bar label {
  font-weight: 600;
  color: #435447;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-primary,
.button-secondary,
.action-btn,
.link {
  transition: all .16s ease;
}

.button-primary,
.button-secondary {
  min-height: 40px;
  border-radius: 12px;
}

.action-btn {
  border: 1px solid #e1e6e1;
}

.action-btn:hover {
  border-color: #c2d1c4;
  transform: translateY(-1px);
}

.action-btn.danger {
  border-color: #f4d6d3;
}

.help-widget {
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
}

.help-button {
  min-height: 44px;
}

.empty {
  border: 1px dashed #ced9cf;
  border-radius: 12px;
  background: #f8faf8;
  padding: 18px 14px;
}

.empty i {
  color: #6c7f6f;
  margin-right: 8px;
}

.petani-cards {
  border-color: #d4ddd4;
  gap: 12px;
}

.petani-card {
  border-color: #c7d2c8;
}

.petani-card.open {
  border-color: #7ba783;
  box-shadow: 0 9px 18px rgba(24, 60, 33, 0.12);
  background: #fbfefb;
}

.petani-main strong {
  letter-spacing: 0.01em;
}

.petani-main small {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.petani-actions-panel {
  background: #fafcfa;
  border-top-color: #d8e2d9;
  border-top-style: dashed;
}

.petani-actions-panel .action-btn {
  min-height: 40px;
}

.activity-panel {
  border: 1px solid #d4ddd5;
}

.activity-panel-head {
  background: #f8fbf8;
}

.activity-list {
  gap: 8px;
}

.activity-item {
  border: 1px solid #d8e1da;
  border-left-width: 4px;
}

.activity-item .activity-line + .activity-line {
  padding-top: 4px;
  border-top: 1px dashed #dbe4dc;
  margin-top: 4px;
}

.matrix-wrap {
  border: 1px solid #d2ddd3;
  border-radius: 14px;
  overflow: auto;
}

.matrix-table {
  min-width: 1080px;
}

.matrix-table th,
.matrix-table td {
  border: 1px solid #d2d9d3;
}

.table-wrap {
  border: 1px solid #d2ddd3;
  border-radius: 12px;
  overflow: auto;
}

.table-row.header {
  background: #f5f8f5;
}

.table-row .cell {
  border-bottom: 1px solid #e1e8e2;
}

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

.kpi-card {
  border: 1px solid #dce5de;
}

.kpi-value {
  letter-spacing: -0.01em;
}

@media (max-width: 1100px) {
  .shell {
    max-width: calc(100vw - 28px);
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
  .nav .link {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .petani-card-filter {
    grid-template-columns: 1fr;
  }
  .area-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    max-width: calc(100vw - 16px);
    padding: 10px;
  }
  .section {
    margin-top: 14px;
  }
  .card {
    border-radius: 12px;
    padding: 14px;
  }
  .card-title {
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
  .actions-col {
    width: 100%;
    justify-content: space-between;
  }
  .petani-cards {
    grid-template-columns: 1fr;
    padding: 8px;
  }
  .petani-card-head {
    grid-template-columns: 44px 1fr;
  }
  .petani-avatar {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .area-summary-header {
    flex-direction: column;
  }
  .area-summary-filter-note {
    width: 100%;
    justify-content: center;
  }
  .area-pie-canvas {
    height: 250px;
  }
  .filter-inline {
    width: 100%;
    gap: 8px;
  }
  .filter-inline > * {
    width: 100%;
  }
  .help-panel {
    right: -4px;
    width: min(320px, calc(100vw - 28px));
  }
}

/* === Design Upgrade V2 === */
:root {
  --ui-border: #d6dfd8;
  --ui-border-strong: #c7d4ca;
  --ui-surface-soft: #f9fbf8;
  --ui-shadow-soft: 0 8px 18px rgba(22, 40, 28, 0.06);
  --ui-shadow-card: 0 12px 26px rgba(20, 38, 26, 0.08);
}

body {
  background: radial-gradient(1200px 420px at 92% -10%, #edf4ee 0%, #f7f8fa 42%, #f7f8fa 100%);
}

.shell {
  max-width: 1240px;
}

.header {
  margin-bottom: 28px;
}

.nav {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--ui-shadow-soft);
  backdrop-filter: blur(4px);
}

.nav .link {
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav .link:hover {
  background: #eef3ee;
}

.nav .link.active {
  box-shadow: 0 8px 16px rgba(47, 125, 50, 0.25);
}

.card {
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  box-shadow: var(--ui-shadow-card);
}

.card-title {
  padding-bottom: 10px;
  border-bottom: 1px solid #ebf0ec;
  margin-bottom: 14px;
}

.filter-bar {
  background: var(--ui-surface-soft);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  padding: 12px;
}

.filter-field label {
  font-weight: 700;
  color: #3f5145;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  border: 1px solid var(--ui-border-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #6ea673;
  box-shadow: 0 0 0 3px rgba(47, 125, 50, 0.16);
}

.button-primary,
button.button-primary {
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 16px rgba(47, 125, 50, 0.22);
}

.button-primary:hover,
button.button-primary:hover {
  transform: translateY(-1px);
}

.action-btn {
  border-radius: 12px;
  border: 1px solid #e2e9e3;
  box-shadow: 0 4px 10px rgba(23, 36, 26, 0.05);
}

.action-btn.danger {
  border-color: #f2d1d1;
}

.table-wrap,
.matrix-wrap {
  border-radius: 14px;
  border: 1px solid var(--ui-border-strong);
  box-shadow: var(--ui-shadow-soft);
  background: #fff;
}

.table-wrap::-webkit-scrollbar,
.matrix-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

.table-wrap::-webkit-scrollbar-thumb,
.matrix-wrap::-webkit-scrollbar-thumb {
  background: #bcc9bf;
  border-radius: 999px;
}

.table-row.header .cell,
.data-table thead th {
  background: linear-gradient(180deg, #f7fbf8, #eef5ef);
  border-bottom: 1px solid var(--ui-border-strong);
}

/* Keep supply-plan matrix header theme (green + white text) */
.matrix-wrap .matrix-table thead th {
  background: #0f6b34;
  color: #fff;
  border-color: #0c5f2e;
}

.petani-cards {
  gap: 14px;
}

.petani-card {
  border: 1px solid var(--ui-border-strong);
  border-radius: 14px;
  box-shadow: var(--ui-shadow-soft);
  background: #fff;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.petani-card:hover {
  transform: translateY(-2px);
  border-color: #b7c9bb;
  box-shadow: 0 12px 24px rgba(28, 48, 32, 0.1);
}

.petani-card-head {
  align-items: flex-start;
}

.petani-main {
  gap: 8px;
}

.petani-main h3 {
  margin-bottom: 2px;
  line-height: 1.2;
}

.petani-main .muted {
  line-height: 1.28;
}

.petani-meta {
  border-left: 1px dashed #d4ded6;
  padding-left: 10px;
}

.petani-actions-panel {
  margin-top: 10px;
  border-top: 1px solid #e7eee8;
  padding-top: 10px;
}

.petani-actions-panel .action-btn {
  width: 100%;
  justify-content: flex-start;
}

.empty-state {
  border: 1px dashed #c7d4ca;
  border-radius: 12px;
  background: #f8fbf8;
  color: #5f7064;
}

@media (max-width: 980px) {
  .nav {
    border-radius: 14px;
    padding: 6px;
  }
  .card {
    border-radius: 14px;
  }
  .petani-card {
    border-radius: 12px;
  }
}

@media (max-width: 720px) {
  .card-title {
    padding-bottom: 8px;
    margin-bottom: 10px;
  }
  .petani-meta {
    border-left: none;
    border-top: 1px dashed #d4ded6;
    padding-left: 0;
    padding-top: 8px;
    margin-top: 6px;
  }
}

.manual-resume-wrap {
  overflow-x: auto;
  border: 1px solid var(--ui-border-strong);
  border-radius: 12px;
  background: #fff;
}

.manual-resume-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.manual-resume-table thead th {
  background: #0f6b34;
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid #0c5f2e;
  text-align: center;
  padding: 10px 8px;
}

.manual-resume-table tbody td {
  border: 1px solid #d7e0d9;
  padding: 10px 8px;
  text-align: center;
  background: #fff;
}

.manual-resume-table tbody td:first-child {
  text-align: left;
  font-weight: 700;
  background: #f8fbf8;
  min-width: 160px;
  width: 160px;
}

.manual-resume-table thead th.product-col-head,
.manual-resume-table thead th.product-col-subhead {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 160px;
  width: 160px;
  background: #0f6b34;
  box-shadow: 1px 0 0 #0c5f2e;
}

.manual-resume-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  box-shadow: 1px 0 0 #d7e0d9;
}

.manual-resume-table td.manual-cell {
  cursor: text;
  min-width: 96px;
}

.manual-resume-table td.manual-cell:focus {
  outline: 2px solid #2f7d32;
  outline-offset: -2px;
  background: #f1fbf2;
}

.manual-resume-table td.manual-cell.is-saving {
  background: #eef7ff;
}

.manual-resume-table td.manual-cell.is-error {
  background: #fdeaea;
}

.manual-summary-chart-wrap {
  margin-top: 14px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  height: 380px;
  display: flex;
  flex-direction: column;
}

.manual-summary-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.manual-summary-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 6px;
}
