/* ==========================================================================
   Ayodha Farm OS — app.css
   Token & komponen dari design-system/ayodha-farm-os/MASTER.md.
   Aturan: view tidak memakai style inline; semua warna lewat token.
   ========================================================================== */

:root {
  /* Merek & netral */
  --afos-brand: #1E5A3A;
  --afos-brand-strong: #15472D;
  --afos-brand-soft: #E3EFE6;
  --afos-gold: #A16207;
  --afos-gold-soft: #FBF1DC;
  --afos-bg: #F4F7F4;
  --afos-surface: #FFFFFF;
  --afos-sunk: #EDF2EE;
  --afos-ink: #17261D;
  --afos-muted: #52615A;
  --afos-line: #D9E2DB;

  /* Status semantik (master prompt #46) */
  --afos-normal: #15803D;      --afos-normal-soft: #DCFCE7;
  --afos-attention: #B45309;   --afos-attention-soft: #FEF3C7;
  --afos-critical: #B91C1C;    --afos-critical-soft: #FEE2E2;
  --afos-inactive: #5F6B66;    --afos-inactive-soft: #E9EEEA;
  --afos-info: #0B6E99;        --afos-info-soft: #E0F2FE;

  /* Tipografi */
  --afos-font-display: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif;
  --afos-font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;

  /* Ruang & bentuk */
  --afos-space-1: 4px;  --afos-space-2: 8px;  --afos-space-3: 12px;
  --afos-space-4: 16px; --afos-space-5: 24px; --afos-space-6: 32px; --afos-space-7: 48px;
  --afos-radius: 10px;
  --afos-touch: 48px;
  --afos-nav-h: 64px;
  --afos-sidebar-w: 240px;
  --afos-ease: cubic-bezier(.2, .7, .3, 1);

  /* Pemetaan ke variabel Bootstrap 5.3 */
  --bs-body-font-family: var(--afos-font-body);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.5;
  --bs-body-bg: var(--afos-bg);
  --bs-body-color: var(--afos-ink);
  --bs-secondary-color: var(--afos-muted);
  --bs-border-color: var(--afos-line);
  --bs-border-radius: var(--afos-radius);
  --bs-link-color: var(--afos-brand);
  --bs-link-color-rgb: 30, 90, 58;
  --bs-link-hover-color: var(--afos-brand-strong);
  --bs-primary: var(--afos-info);        --bs-primary-rgb: 11, 110, 153;
  --bs-success: var(--afos-normal);      --bs-success-rgb: 21, 128, 61;
  --bs-warning: var(--afos-attention);   --bs-warning-rgb: 180, 83, 9;
  --bs-danger: var(--afos-critical);     --bs-danger-rgb: 185, 28, 28;
  --bs-secondary: var(--afos-inactive);  --bs-secondary-rgb: 95, 107, 102;
  --bs-focus-ring-color: rgba(30, 90, 58, .35);
}

/* ---------- Dasar ---------- */
body { background: var(--afos-bg); color: var(--afos-ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .afos-display { font-family: var(--afos-font-display); font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1, .h1 { font-size: 1.375rem; line-height: 1.25; margin: 0; }
h2, .h2 { font-size: 1.125rem; line-height: 1.3; margin: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.text-muted, .form-text { color: var(--afos-muted) !important; }
.small, small { font-size: .875rem; } /* minimum 14px */

.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 2000; background: var(--afos-surface); padding: 8px 12px; border-radius: var(--afos-radius); }
.skip-link:focus { left: 8px; }

@media (min-width: 768px) {
  h1, .h1 { font-size: 1.625rem; }
}

/* ---------- Shell: topbar + navigasi ---------- */
.afos-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: var(--afos-space-3);
  min-height: 56px; padding-inline: var(--afos-space-4);
  background: var(--afos-surface); border-bottom: 1px solid var(--afos-line);
}
.afos-topbar__title { flex: 1; min-width: 0; font-size: 1.0625rem; font-family: var(--afos-font-display); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.afos-avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--afos-brand-soft); color: var(--afos-brand);
  font-family: var(--afos-font-display); font-weight: 600; text-decoration: none;
}
.afos-icon-btn { position: relative; display: inline-grid; place-items: center; width: var(--afos-touch); height: var(--afos-touch); border-radius: 50%; color: var(--afos-ink); font-size: 1.25rem; text-decoration: none; }
.afos-icon-btn:hover { background: var(--afos-sunk); color: var(--afos-ink); }
.afos-badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--afos-critical); color: #fff; font: 700 .6875rem/18px var(--afos-font-body); text-align: center; font-variant-numeric: tabular-nums; }
.afos-nav__icon { position: relative; }
.afos-nav__icon .afos-badge { top: -4px; right: 6px; }
@media (min-width: 992px) { .afos-nav__icon .afos-badge { top: -8px; right: -10px; } }
.afos-avatar-hit { display: inline-grid; place-items: center; width: var(--afos-touch); height: var(--afos-touch); margin-right: -4px; border-radius: 50%; text-decoration: none; }

.afos-mark { display: inline-flex; align-items: center; gap: var(--afos-space-2); text-decoration: none; color: var(--afos-ink); }
.afos-mark img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.afos-mark__name { font-family: var(--afos-font-display); font-weight: 600; font-size: 1rem; line-height: 1.1; }
.afos-mark__sub { font-size: .75rem; color: var(--afos-muted); letter-spacing: .02em; }

.afos-content { width: 100%; max-width: 720px; margin-inline: auto; padding: var(--afos-space-4) var(--afos-space-4) calc(var(--afos-nav-h) + var(--afos-space-6) + env(safe-area-inset-bottom)); }
.afos-content--wide { max-width: 1200px; }

.afos-nav {
  position: fixed; inset: auto 0 0 0; z-index: 1030;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--afos-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--afos-surface); border-top: 1px solid var(--afos-line);
}
.afos-nav__brand, .afos-nav__foot { display: none; }
.afos-nav--hidden-mobile { display: none; }
.afos-nav__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--afos-touch); color: var(--afos-muted); text-decoration: none;
  font-size: .8125rem; font-weight: 600;
  transition: color .15s var(--afos-ease);
}
.afos-nav__icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; font-size: 1.25rem; transition: background-color .15s var(--afos-ease); }
.afos-nav__item:hover { color: var(--afos-ink); }
.afos-nav__item[aria-current="page"] { color: var(--afos-brand); }
.afos-nav__item[aria-current="page"] .afos-nav__icon { background: var(--afos-brand-soft); }

@media (min-width: 992px) {
  .afos-shell { display: grid; grid-template-columns: var(--afos-sidebar-w) minmax(0, 1fr); min-height: 100vh; }
  .afos-nav {
    position: sticky; top: 0; inset: auto; height: 100vh; padding: var(--afos-space-4) var(--afos-space-3);
    display: flex; flex-direction: column; gap: var(--afos-space-1);
    border-top: 0; border-right: 1px solid var(--afos-line);
  }
  .afos-nav--hidden-mobile { display: flex; }
  .afos-nav__brand { display: flex; padding: var(--afos-space-2) var(--afos-space-2) var(--afos-space-5); }
  .afos-nav__foot { display: block; margin-top: auto; padding: var(--afos-space-3) var(--afos-space-2) 0; border-top: 1px solid var(--afos-line); }
  .afos-nav__item { flex-direction: row; justify-content: flex-start; gap: var(--afos-space-3); padding: 0 var(--afos-space-3); border-radius: var(--afos-radius); font-size: .9375rem; }
  .afos-nav__icon { width: 24px; height: 24px; background: none !important; }
  .afos-nav__item[aria-current="page"] { background: var(--afos-brand-soft); }
  .afos-topbar .afos-mark { display: none; }
  .afos-content { padding-bottom: var(--afos-space-7); }
}

/* ---------- Kartu & tata letak ---------- */
.afos-card { background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); padding: var(--afos-space-4); }
.afos-card + .afos-card { margin-top: var(--afos-space-3); }
.afos-stack { display: grid; gap: var(--afos-space-4); }
.afos-stack--sm { display: grid; gap: var(--afos-space-2); }
.afos-section-label { font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--afos-muted); margin: 0; }
.afos-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--afos-space-3); }
.afos-page-head p { margin: 2px 0 0; color: var(--afos-muted); }

.afos-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-3); }
@media (min-width: 768px) { .afos-stats--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.afos-stat { background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); padding: var(--afos-space-3) var(--afos-space-4); }
.afos-stat__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.75rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.afos-stat__label { font-size: .875rem; color: var(--afos-muted); }

/* Daftar baris (pengganti tabel di mobile) */
.afos-list { list-style: none; margin: 0; padding: 0; background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); }
.afos-list__row { display: flex; align-items: center; gap: var(--afos-space-3); min-height: 64px; padding: var(--afos-space-3) var(--afos-space-4); border-bottom: 1px solid var(--afos-line); color: inherit; text-decoration: none; }
.afos-list > li:last-child .afos-list__row { border-bottom: 0; }
a.afos-list__row:hover { background: var(--afos-sunk); }
.afos-list__main { flex: 1; min-width: 0; }
.afos-list__title { font-weight: 600; overflow-wrap: anywhere; }
.afos-list__meta { font-size: .875rem; color: var(--afos-muted); overflow-wrap: anywhere; }
.afos-list__chev { color: var(--afos-muted); font-size: 1.125rem; }

.afos-gh-code { font-family: var(--afos-font-display); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Status badge (dot + label) ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .875rem; font-weight: 600;
  color: var(--status-fg); background: var(--status-bg);
}
.status-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-badge--normal    { --status-fg: var(--afos-normal);    --status-bg: var(--afos-normal-soft); }
.status-badge--attention { --status-fg: var(--afos-attention); --status-bg: var(--afos-attention-soft); }
.status-badge--critical  { --status-fg: var(--afos-critical);  --status-bg: var(--afos-critical-soft); }
.status-badge--inactive  { --status-fg: var(--afos-inactive);  --status-bg: var(--afos-inactive-soft); }
.status-badge--info      { --status-fg: var(--afos-info);      --status-bg: var(--afos-info-soft); }

.role-chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; background: var(--afos-sunk); color: var(--afos-muted); }

/* ---------- Tombol ---------- */
.btn { --bs-btn-border-radius: var(--afos-radius); --bs-btn-font-weight: 600; min-height: var(--afos-touch); display: inline-flex; align-items: center; justify-content: center; gap: var(--afos-space-2); padding-inline: var(--afos-space-4); transition: background-color .15s var(--afos-ease), border-color .15s var(--afos-ease), color .15s var(--afos-ease); }
.btn-brand {
  --bs-btn-color: #fff; --bs-btn-bg: var(--afos-brand); --bs-btn-border-color: var(--afos-brand);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--afos-brand-strong); --bs-btn-hover-border-color: var(--afos-brand-strong);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--afos-brand-strong); --bs-btn-active-border-color: var(--afos-brand-strong);
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--afos-brand); --bs-btn-disabled-border-color: var(--afos-brand);
}
.btn-quiet {
  --bs-btn-color: var(--afos-ink); --bs-btn-bg: var(--afos-surface); --bs-btn-border-color: var(--afos-line);
  --bs-btn-hover-color: var(--afos-ink); --bs-btn-hover-bg: var(--afos-sunk); --bs-btn-hover-border-color: var(--afos-line);
  --bs-btn-active-bg: var(--afos-sunk); --bs-btn-active-border-color: var(--afos-muted); --bs-btn-active-color: var(--afos-ink);
}
.btn-danger-quiet {
  --bs-btn-color: var(--afos-critical); --bs-btn-bg: var(--afos-surface); --bs-btn-border-color: var(--afos-line);
  --bs-btn-hover-color: var(--afos-critical); --bs-btn-hover-bg: var(--afos-critical-soft); --bs-btn-hover-border-color: var(--afos-critical);
  --bs-btn-active-color: var(--afos-critical); --bs-btn-active-bg: var(--afos-critical-soft); --bs-btn-active-border-color: var(--afos-critical);
}
.btn-block { width: 100%; }
.btn .spinner-border { width: 1.1rem; height: 1.1rem; border-width: .16em; }
.btn.is-loading { pointer-events: none; opacity: .75; }

/* ---------- Form ---------- */
.form-label { font-weight: 600; font-size: .9375rem; margin-bottom: 6px; }
.form-control, .form-select { min-height: var(--afos-touch); font-size: 1rem; border-color: var(--afos-line); border-radius: var(--afos-radius); background-color: var(--afos-surface); color: var(--afos-ink); }
.form-control:focus, .form-select:focus { border-color: var(--afos-brand); box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--afos-critical); background-image: none; padding-right: .75rem; }
.invalid-feedback { display: block; color: var(--afos-critical); font-size: .875rem; font-weight: 600; margin-top: 6px; }
.form-check-input { width: 1.375rem; height: 1.375rem; margin-top: .05rem; border-color: var(--afos-muted); }
.form-check-input:checked { background-color: var(--afos-brand); border-color: var(--afos-brand); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color); border-color: var(--afos-brand); }
.afos-check { display: flex; align-items: center; gap: var(--afos-space-3); min-height: var(--afos-touch); }
.afos-check .form-check-input { margin: 0; flex: none; }

.afos-password { position: relative; }
.afos-password .form-control { padding-right: 56px; }
.afos-password__toggle { position: absolute; right: 0; top: 0; width: var(--afos-touch); height: var(--afos-touch); border: 0; background: none; color: var(--afos-muted); border-radius: var(--afos-radius); font-size: 1.25rem; }
.afos-password__toggle:hover { color: var(--afos-ink); }

.afos-form-actions { display: flex; flex-wrap: wrap; gap: var(--afos-space-3); }
@media (max-width: 575.98px) { .afos-form-actions .btn { flex: 1 1 100%; } }

/* Pilihan peran sebagai tombol besar (pilihan > dropdown) */
.afos-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
.afos-choice > div { display: flex; min-width: 0; }
.afos-choice label { min-width: 0; }
.afos-choice input { position: absolute; opacity: 0; pointer-events: none; }
.afos-choice label {
  flex: 1;
  display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: var(--afos-space-3);
  border: 1.5px solid var(--afos-line); border-radius: var(--afos-radius); background: var(--afos-surface);
  cursor: pointer; transition: border-color .15s var(--afos-ease), background-color .15s var(--afos-ease);
}
.afos-choice label strong { font-size: .9375rem; }
.afos-choice label span { font-size: .8125rem; color: var(--afos-muted); line-height: 1.3; }
.afos-choice input:checked + label { border-color: var(--afos-brand); background: var(--afos-brand-soft); }
.afos-choice input:focus-visible + label { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.afos-choice.is-invalid label { border-color: var(--afos-critical); }
.afos-choice input:disabled + label { opacity: .5; cursor: not-allowed; }
.afos-choice--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.afos-choice--3 label { padding: var(--afos-space-2) 10px; }
.afos-choice--gh { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.afos-choice--gh label { min-height: 56px; padding: var(--afos-space-2); }
.afos-choice--gh label strong { font-family: var(--afos-font-display); }
.afos-choice--gh label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) { .afos-choice--gh { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

/* ---------- Alert / flash ---------- */
.afos-alert { display: flex; gap: var(--afos-space-3); align-items: flex-start; padding: var(--afos-space-3) var(--afos-space-4); border-radius: var(--afos-radius); border: 1px solid transparent; font-weight: 600; }
.afos-alert .bi { font-size: 1.25rem; line-height: 1.2; flex: none; }
.afos-alert--success { background: var(--afos-normal-soft); color: #14532D; border-color: #BBE5C8; }
.afos-alert--info    { background: var(--afos-info-soft); color: #075170; border-color: #BAE0F5; }
.afos-alert--warning { background: var(--afos-attention-soft); color: #7C3A06; border-color: #F4D99A; }
.afos-alert--danger  { background: var(--afos-critical-soft); color: #8A1616; border-color: #F6C1C1; }
.afos-flash { display: grid; gap: var(--afos-space-2); margin-bottom: var(--afos-space-4); }

.afos-secret { display: flex; align-items: center; justify-content: space-between; gap: var(--afos-space-3); padding: var(--afos-space-3) var(--afos-space-4); border: 1.5px dashed var(--afos-gold); background: var(--afos-gold-soft); border-radius: var(--afos-radius); }
.afos-secret code { font-family: var(--afos-font-display); font-size: 1.375rem; font-weight: 600; letter-spacing: .08em; color: var(--afos-ink); background: none; }

/* ---------- Halaman login ---------- */
.afos-auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.afos-auth__band {
  background-color: var(--afos-brand);
  /* garis tipis horizontal = barisan channel NFT di greenhouse */
  background-image: repeating-linear-gradient(180deg, transparent 0 17px, rgba(255, 255, 255, .07) 17px 19px);
  color: #fff; padding: var(--afos-space-6) var(--afos-space-4) 88px;
}
.afos-auth__brand { max-width: 420px; margin-inline: auto; display: grid; justify-items: center; gap: var(--afos-space-3); text-align: center; }
.afos-auth__logo { width: 136px; height: 136px; padding: 6px; border-radius: 24px; background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.afos-auth__product { display: grid; gap: 2px; padding-top: var(--afos-space-3); border-top: 1px solid rgba(255, 255, 255, .22); }
.afos-auth__brand h1 { font-size: 1.5rem; color: #fff; margin: 0; }
.afos-auth__brand p { margin: 0; color: rgba(255, 255, 255, .8); font-size: .9375rem; }
.afos-auth__body { padding: 0 var(--afos-space-4) var(--afos-space-6); }
.afos-auth__card { max-width: 420px; margin: -60px auto 0; background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: 14px; padding: var(--afos-space-5); }
.afos-auth__foot { max-width: 420px; margin: var(--afos-space-4) auto 0; text-align: center; color: var(--afos-muted); font-size: .9375rem; }

/* ---------- Error page ---------- */
.afos-error { min-height: 100vh; display: grid; place-items: center; padding: var(--afos-space-5) var(--afos-space-4); text-align: center; }
.afos-error__code { font-family: var(--afos-font-display); font-weight: 600; font-size: 3.5rem; line-height: 1; color: var(--afos-brand); font-variant-numeric: tabular-nums; }
.afos-error__box { max-width: 420px; display: grid; gap: var(--afos-space-3); justify-items: center; }
.afos-error__logo { width: 128px; height: 128px; border-radius: 20px; }
.afos-error pre { text-align: left; max-width: 90vw; overflow: auto; font-size: .75rem; background: var(--afos-sunk); padding: var(--afos-space-3); border-radius: var(--afos-radius); }

/* ---------- Tabel desktop ---------- */
.afos-table-wrap { overflow-x: auto; background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); }
.afos-table { width: 100%; margin: 0; font-size: .9375rem; }
.afos-table th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .05em; color: var(--afos-muted); background: var(--afos-sunk); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--afos-line); white-space: nowrap; }
.afos-table td { padding: 12px 14px; border-bottom: 1px solid var(--afos-line); vertical-align: middle; }
.afos-table tr:last-child td { border-bottom: 0; }

/* ==========================================================================
   Phase 02 — greenhouse, siklus, fase
   ========================================================================== */

/* Chip filter / segmented (pilihan > dropdown) */
.afos-chips { display: flex; gap: var(--afos-space-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.afos-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--afos-line); border-radius: 999px; background: var(--afos-surface);
  color: var(--afos-ink); font-weight: 600; font-size: .9375rem; text-decoration: none; white-space: nowrap;
  transition: background-color .15s var(--afos-ease), border-color .15s var(--afos-ease);
}
.afos-chip:hover { background: var(--afos-sunk); color: var(--afos-ink); }
.afos-chip[aria-current="true"] { background: var(--afos-brand); border-color: var(--afos-brand); color: #fff; }
.afos-chip__count { font-variant-numeric: tabular-nums; color: var(--afos-muted); font-weight: 600; }
.afos-chip[aria-current="true"] .afos-chip__count { color: rgba(255, 255, 255, .8); }

/* Label fase & status siklus */
.phase-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 700; background: var(--afos-brand-soft); color: var(--afos-brand); white-space: nowrap; }
.phase-chip--secondary { background: var(--afos-sunk); color: var(--afos-muted); font-weight: 600; }
.cycle-status { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; font-weight: 600; color: var(--afos-muted); white-space: nowrap; }
.cycle-status .bi { font-size: 1rem; }

.hst { font-family: var(--afos-font-display); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hst--lg { font-size: 2.25rem; line-height: 1; }
.hst__unit { font-size: .9375rem; font-weight: 500; color: var(--afos-muted); margin-right: 4px; }

/* Grid kartu greenhouse */
.gh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--afos-space-3); }
.gh-card {
  display: grid; gap: var(--afos-space-2); align-content: start; padding: var(--afos-space-4);
  background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius);
  color: inherit; text-decoration: none; transition: border-color .15s var(--afos-ease), background-color .15s var(--afos-ease);
}
a.gh-card:hover { border-color: var(--afos-brand); color: inherit; }
.gh-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--afos-space-2); }
.gh-card__code { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.125rem; }
.gh-card__variety { font-weight: 600; }
.gh-card__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--afos-space-2); }
.gh-card__empty { color: var(--afos-muted); }

/* Baris GH di beranda grower/agronomist */
.gh-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--afos-space-3); min-height: 72px; padding: var(--afos-space-3) var(--afos-space-4); border-bottom: 1px solid var(--afos-line); color: inherit; text-decoration: none; }
.afos-list > li:last-child .gh-row { border-bottom: 0; }
a.gh-row:hover { background: var(--afos-sunk); color: inherit; }
.gh-row__code { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.0625rem; min-width: 56px; }
.gh-row__main { min-width: 0; display: grid; gap: 2px; }
.gh-row__variety { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-row__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; color: var(--afos-muted); }
.gh-row__hst { text-align: right; }
.gh-row__hst .hst { font-size: 1.375rem; line-height: 1; display: block; }
.gh-row__hst small { color: var(--afos-muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }

/* Pasangan label–nilai */
.afos-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-3) var(--afos-space-4); margin: 0; }
@media (min-width: 768px) { .afos-kv--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.afos-kv dt { font-size: .8125rem; font-weight: 600; color: var(--afos-muted); }
.afos-kv dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Hero siklus */
.cycle-hero { display: grid; gap: var(--afos-space-3); }
.cycle-hero__top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--afos-space-3); }
.cycle-hero__phases { display: flex; flex-wrap: wrap; gap: 6px; }
.target-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
.target { padding: var(--afos-space-2) var(--afos-space-3); border-radius: 8px; background: var(--afos-sunk); }
.target__label { font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--afos-muted); }
.target__value { font-family: var(--afos-font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.target__value--empty { font-family: var(--afos-font-body); font-weight: 400; color: var(--afos-muted); font-size: .9375rem; }

/* Stepper status siklus */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.stepper li { flex: 1 1 0; min-width: 0; display: grid; gap: 6px; }
/* Hanya batang; nama tahap aktif ditulis di atas stepper, nama tiap tahap untuk pembaca layar & tooltip.
   (10 label tidak muat di kolom konten 720px tanpa bertumpuk.) */
.stepper__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stepper li { cursor: default; }
.stepper__bar { height: 6px; border-radius: 3px; background: var(--afos-line); }
.stepper__label { font-size: .75rem; font-weight: 600; color: var(--afos-muted); white-space: nowrap; }
.stepper li.is-done .stepper__bar { background: var(--afos-brand); opacity: .45; }
.stepper li.is-current .stepper__bar { background: var(--afos-brand); }
.stepper li.is-current .stepper__label { color: var(--afos-brand); font-weight: 700; }

/* Tombol pilihan status */
.status-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--afos-space-2); }
.status-options .btn { justify-content: flex-start; text-align: left; }
.status-options .btn.is-suggested { border-color: var(--afos-brand); background: var(--afos-brand-soft); }

/* Timeline fase (range per fase, SVG persentase — tanpa style inline karena CSP) */
.phase-tl { display: grid; gap: 2px; }
.phase-tl__row { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: var(--afos-space-3); min-height: 30px; }
.phase-tl__name { font-size: .875rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-tl__range { display: block; font-size: .75rem; font-weight: 400; color: var(--afos-muted); font-variant-numeric: tabular-nums; }
.phase-tl__row.is-active .phase-tl__name { color: var(--afos-brand); }
.phase-tl__track { display: block; width: 100%; height: 22px; overflow: visible; }
.phase-tl__grid { stroke: var(--afos-line); stroke-width: 1; }
.phase-tl__bar { fill: var(--afos-brand-soft); stroke: #9BBFA8; stroke-width: 1; }
.phase-tl__row.is-active .phase-tl__bar { fill: var(--afos-brand); stroke: var(--afos-brand); }
.phase-tl__row.is-inactive .phase-tl__bar { fill: var(--afos-sunk); stroke: var(--afos-line); stroke-dasharray: 3 3; }
.phase-tl__open { fill: none; stroke: #9BBFA8; stroke-width: 1.5; stroke-dasharray: 2 3; }
.phase-tl__today { stroke: var(--afos-ink); stroke-width: 2; }
.phase-tl__axis { font-size: 11px; fill: var(--afos-muted); font-family: var(--afos-font-body); }
.phase-tl__axis-row .phase-tl__track { height: 18px; }
.phase-tl__legend { display: flex; flex-wrap: wrap; gap: var(--afos-space-3); font-size: .8125rem; color: var(--afos-muted); }
.phase-tl__legend span { display: inline-flex; align-items: center; gap: 6px; }
.phase-tl__key { width: 18px; height: 8px; border-radius: 4px; background: var(--afos-brand-soft); border: 1px solid #9BBFA8; }
.phase-tl__key--active { background: var(--afos-brand); border-color: var(--afos-brand); }
.phase-tl__key--today { width: 2px; height: 14px; border-radius: 0; background: var(--afos-ink); border: 0; }
@media (max-width: 400px) { .phase-tl__row { grid-template-columns: 104px minmax(0, 1fr); } }

/* Pohon struktur NFT */
.nft-tree, .nft-tree ul { list-style: none; margin: 0; padding: 0; }
.nft-tree ul { margin-left: var(--afos-space-4); padding-left: var(--afos-space-3); border-left: 2px solid var(--afos-line); }
.nft-node { display: flex; flex-wrap: wrap; align-items: center; gap: var(--afos-space-2); min-height: 44px; padding: 4px 0; }
.nft-node__type { font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--afos-muted); min-width: 72px; }
.nft-node__code { font-family: var(--afos-font-display); font-weight: 600; }
.nft-node.is-off .nft-node__code { color: var(--afos-muted); text-decoration: line-through; }
.nft-channels { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0 8px; }
.nft-channel { display: inline-flex; }
.nft-channel button { min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--afos-line); background: var(--afos-surface); font-weight: 600; font-variant-numeric: tabular-nums; font-size: .875rem; color: var(--afos-ink); }
.nft-channel button:hover { border-color: var(--afos-critical); color: var(--afos-critical); }
.nft-channel.is-off button { color: var(--afos-muted); text-decoration: line-through; background: var(--afos-sunk); }
.nft-channel.is-off button:hover { border-color: var(--afos-normal); color: var(--afos-normal); text-decoration: none; }
details.afos-disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--afos-space-2); min-height: var(--afos-touch); font-weight: 600; color: var(--afos-brand); }
details.afos-disclosure > summary::-webkit-details-marker { display: none; }
details.afos-disclosure > summary .bi { transition: transform .15s var(--afos-ease); }
details.afos-disclosure[open] > summary .bi-chevron-down { transform: rotate(180deg); }

/* Riwayat */
.afos-history { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--afos-space-3); }
.afos-history li { display: grid; grid-template-columns: 10px 1fr; gap: var(--afos-space-3); }
.afos-history li::before { content: ""; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--afos-line); }
.afos-history__what { font-weight: 600; overflow-wrap: anywhere; }
.afos-history__when { font-size: .8125rem; color: var(--afos-muted); }

.afos-empty { display: grid; justify-items: center; gap: var(--afos-space-3); padding: var(--afos-space-6) var(--afos-space-4); text-align: center; background: var(--afos-surface); border: 1px dashed var(--afos-line); border-radius: var(--afos-radius); color: var(--afos-muted); }
.afos-empty .bi { font-size: 2rem; color: var(--afos-brand); }

/* ==========================================================================
   Peta tanaman (populasi per lubang)
   Status tidak pernah hanya warna: hidup • / mati ✕ / disulam ↻ + label.
   ========================================================================== */
:root {
  --plant-alive: #CFE6D6;       --plant-alive-ink: var(--afos-normal);
  --plant-dead: var(--afos-critical);
  --plant-replanted: #7CB9D6;   --plant-replanted-ink: var(--afos-info);
}
.plant-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--afos-space-2); }
.plant-stat { display: flex; align-items: center; gap: var(--afos-space-2); padding: var(--afos-space-3); border-radius: var(--afos-radius); background: var(--afos-surface); border: 1px solid var(--afos-line); }
.plant-stat .bi { font-size: 1rem; flex: none; }
.plant-stat__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plant-stat__label { font-size: .8125rem; color: var(--afos-muted); font-weight: 600; }
.plant-stat--alive .bi { color: var(--plant-alive-ink); }
.plant-stat--dead .bi { color: var(--plant-dead); }
.plant-stat--replanted .bi { color: var(--plant-replanted-ink); }

.plant-legend { display: flex; flex-wrap: wrap; gap: var(--afos-space-3); font-size: .8125rem; color: var(--afos-muted); }
.plant-legend span { display: inline-flex; align-items: center; gap: 6px; }
.plant-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.plant-key--alive { background: var(--plant-alive); }
.plant-key--dead { background: var(--plant-dead); }
.plant-key--replanted { background: var(--plant-replanted); }

.plant-channel-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: var(--afos-space-3); min-height: 64px; padding: var(--afos-space-2) var(--afos-space-4); border-bottom: 1px solid var(--afos-line); color: inherit; text-decoration: none; }
.afos-list > li:last-child .plant-channel-row { border-bottom: 0; }
a.plant-channel-row:hover { background: var(--afos-sunk); color: inherit; }
.plant-channel-row__code { font-family: var(--afos-font-display); font-weight: 600; }
.plant-channel-row__main { display: grid; gap: 4px; min-width: 0; }
.plant-channel-row__meta { font-size: .8125rem; color: var(--afos-muted); }
.plant-strip { display: block; width: 100%; height: 14px; }
.plant-strip__alive { fill: var(--plant-alive); }
.plant-strip__dead { fill: var(--plant-dead); }
.plant-strip__replanted { fill: var(--plant-replanted); }

/* Grid lubang: tombol ≥48px, 6 kolom di HP, lebih banyak di layar lebar */
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.plant-tile { position: relative; }
.plant-tile input { position: absolute; opacity: 0; pointer-events: none; }
.plant-tile label {
  display: grid; place-items: center; align-content: center; gap: 0; min-height: 56px; border-radius: 10px;
  border: 1.5px solid var(--afos-line); background: var(--afos-surface); cursor: pointer; user-select: none;
  transition: border-color .12s var(--afos-ease), background-color .12s var(--afos-ease), box-shadow .12s var(--afos-ease);
}
.plant-tile__no { font-family: var(--afos-font-display); font-weight: 600; font-size: 1rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plant-tile__icon { font-size: .75rem; line-height: 1; }
.plant-tile--alive .plant-tile__icon { color: var(--plant-alive-ink); font-size: .5rem; }
.plant-tile--dead label { background: var(--afos-critical-soft); border-color: #F3A7A7; }
.plant-tile--dead .plant-tile__no, .plant-tile--dead .plant-tile__icon { color: var(--afos-critical); }
.plant-tile--replanted label { background: var(--afos-info-soft); border-color: #9FCDE6; }
.plant-tile--replanted .plant-tile__icon { color: var(--afos-info); }
.plant-tile input:checked + label { border-color: var(--afos-brand); box-shadow: 0 0 0 3px var(--afos-brand); }
.plant-tile input:checked + label::after {
  content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem;
  background: var(--afos-brand); color: #fff;
}
.plant-tile input:focus-visible + label { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.plant-tile label:not([for]) { cursor: default; }

.plant-actions {
  position: sticky; bottom: calc(var(--afos-nav-h) + env(safe-area-inset-bottom) + 8px); z-index: 10;
  display: grid; gap: var(--afos-space-2); padding: var(--afos-space-3); border-radius: 14px;
  background: var(--afos-surface); border: 1px solid var(--afos-line); box-shadow: 0 6px 24px rgba(23, 38, 29, .12);
}
@media (min-width: 992px) { .plant-actions { bottom: var(--afos-space-4); } }
.plant-actions__count { font-weight: 700; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.plant-actions__hint { display: none; font-size: .875rem; }
/* Belum ada pilihan: panel menyusut jadi satu baris petunjuk agar grid tidak tertutup (JS menambah .is-empty). */
.plant-actions.is-empty { padding-block: var(--afos-space-2); }
.plant-actions.is-empty [data-selected-label],
.plant-actions.is-empty .plant-actions__causes,
.plant-actions.is-empty .plant-actions__buttons,
.plant-actions.is-empty .plant-actions__note { display: none; }
.plant-actions.is-empty .plant-actions__hint { display: inline; }
.plant-actions.no-living .plant-actions__causes { display: none; }
.plant-actions__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--afos-space-2); }
.plant-actions__causes { margin: 0; }
.afos-chip--radio { cursor: pointer; min-height: 36px; font-size: .875rem; }
.afos-chip--radio:has(input:checked) { background: var(--afos-critical-soft); border-color: var(--afos-critical); color: var(--afos-critical); }
.afos-chip--radio:has(input:focus-visible) { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.btn-danger-solid {
  --bs-btn-color: #fff; --bs-btn-bg: var(--afos-critical); --bs-btn-border-color: var(--afos-critical);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #991B1B; --bs-btn-hover-border-color: #991B1B;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #991B1B; --bs-btn-active-border-color: #991B1B;
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--afos-critical); --bs-btn-disabled-border-color: var(--afos-critical);
}
.btn:disabled { opacity: .45; }

.plant-code { font-family: var(--afos-font-display); font-weight: 600; margin-right: 4px; }
.plant-event.is-undone .afos-history__what { text-decoration: line-through; color: var(--afos-muted); }
.afos-history li.plant-event--dead::before { background: var(--plant-dead); }
.afos-history li.plant-event--replanted::before { background: var(--plant-replanted); }
.afos-history li.plant-event.is-undone::before { background: var(--afos-line); }

/* ==========================================================================
   Phase 03 — tugas, notifikasi, halaman kerja GH, foto
   ========================================================================== */
.task-progress { display: grid; gap: 6px; padding: var(--afos-space-3) var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); color: inherit; text-decoration: none; }
a.task-progress:hover { border-color: var(--afos-brand); color: inherit; }
.task-progress__text { display: flex; justify-content: space-between; gap: var(--afos-space-2); align-items: baseline; }
.task-progress__bar { width: 100%; height: 8px; display: block; }
.task-progress__track { fill: var(--afos-sunk); }
.task-progress__fill { fill: var(--afos-brand); }

.task-list { display: grid; background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); }
.task-list--flat { border: 0; background: none; }
.task-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: var(--afos-space-3); min-height: 64px; padding: var(--afos-space-2) var(--afos-space-3); border-bottom: 1px solid var(--afos-line); }
.task-item:last-child { border-bottom: 0; }
.task-list--flat .task-item { padding-inline: 0; }
.task-item__icon { font-size: 1.375rem; color: var(--afos-muted); text-align: center; }
.task-item--done .task-item__icon { color: var(--afos-normal); }
.task-item--overdue .task-item__icon { color: var(--afos-critical); }
.task-item__main { display: grid; gap: 2px; min-width: 0; color: inherit; text-decoration: none; padding-block: 4px; }
.task-item__main:hover { color: inherit; }
.task-item__title { font-weight: 600; overflow-wrap: anywhere; }
.task-item--done .task-item__title, .task-item--skipped .task-item__title { color: var(--afos-muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.task-item__meta { font-size: .8125rem; color: var(--afos-muted); overflow-wrap: anywhere; }
.task-item__action { flex: none; }
.btn-sm { --bs-btn-padding-x: .75rem; min-height: 44px; font-size: .9375rem; }
.gh-grid--tasks { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }

.afos-chip--pick { cursor: pointer; }
.afos-chip--pick:has(input:checked) { background: var(--afos-brand); border-color: var(--afos-brand); color: #fff; }
.afos-chip--pick:has(input:focus-visible) { outline: 3px solid var(--afos-brand); outline-offset: 2px; }

.notif__icon { font-size: 1.25rem; color: var(--afos-muted); }
.notif--unread { background: var(--afos-brand-soft); }
.notif--unread .notif__icon { color: var(--afos-brand); }
.notif--unread .afos-list__title { font-weight: 700; }

.field-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
@media (min-width: 768px) { .field-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field-action { display: grid; gap: 2px; align-content: start; min-height: 88px; padding: var(--afos-space-3); border-radius: var(--afos-radius); border: 1.5px solid var(--afos-line); background: var(--afos-surface); color: var(--afos-ink); text-decoration: none; transition: border-color .15s var(--afos-ease), background-color .15s var(--afos-ease); }
.field-action:hover { border-color: var(--afos-brand); color: var(--afos-ink); }
.field-action .bi { font-size: 1.5rem; color: var(--afos-brand); }
.field-action__label { font-weight: 700; }
.field-action__meta { font-size: .8125rem; color: var(--afos-muted); }
.field-action--primary { border-color: var(--afos-brand); background: var(--afos-brand-soft); }
.field-action--danger .bi { color: var(--afos-critical); }

.afos-photo { display: block; max-width: 100%; width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--afos-radius); border: 1px solid var(--afos-line); background: var(--afos-sunk); }
.photo-input { display: grid; gap: var(--afos-space-2); }
.photo-input__button { justify-self: start; min-width: 200px; border-style: dashed; border-width: 2px; }
.photo-input__button:has(+ input:focus-visible) { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.photo-input__previews { display: flex; flex-wrap: wrap; gap: var(--afos-space-2); }
.photo-thumb { position: relative; width: 88px; height: 88px; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--afos-line); }
.photo-thumb button { position: absolute; top: -8px; right: -8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--afos-ink); color: #fff; display: grid; place-items: center; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--afos-space-2); }

/* ==========================================================================
   Phase 04 — cek harian, laporan masalah, kondisi GH
   ========================================================================== */
.status-choice-set { margin: 0; }
.status-choice { display: grid; gap: var(--afos-space-2); }
.status-choice--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-choice--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status-choice__item { display: flex; min-width: 0; }
.status-choice__item input { position: absolute; opacity: 0; pointer-events: none; }
.status-choice__item label {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: var(--afos-space-2); text-align: center; line-height: 1.2; cursor: pointer;
  border: 2px solid var(--afos-line); border-radius: var(--afos-radius); background: var(--afos-surface);
  font-weight: 700; font-size: .9375rem; color: var(--afos-ink);
  transition: border-color .12s var(--afos-ease), background-color .12s var(--afos-ease);
}
.status-choice--lg .status-choice__item label { min-height: 88px; font-size: 1rem; }
.status-choice__item label .bi { font-size: 1.375rem; color: var(--sc-fg); }
.status-choice__item--normal    { --sc-fg: var(--afos-normal);    --sc-bg: var(--afos-normal-soft); }
.status-choice__item--attention { --sc-fg: var(--afos-attention); --sc-bg: var(--afos-attention-soft); }
.status-choice__item--critical  { --sc-fg: var(--afos-critical);  --sc-bg: var(--afos-critical-soft); }
.status-choice__item--info      { --sc-fg: var(--afos-info);      --sc-bg: var(--afos-info-soft); }
.status-choice__item input:checked + label { border-color: var(--sc-fg); background: var(--sc-bg); box-shadow: inset 0 0 0 1px var(--sc-fg); }
.status-choice__item input:focus-visible + label { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.status-choice-set.is-invalid .status-choice__item label { border-color: #F3A7A7; }

.measure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-3); }
.measure { display: grid; gap: 6px; align-content: start; }
.measure__input { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.625rem; min-height: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.measure__target { font-size: .8125rem; color: var(--afos-muted); }
.measure__warning { padding: 8px 10px; border-radius: 8px; background: var(--afos-critical-soft); color: #8A1616; font-size: .875rem; font-weight: 600; line-height: 1.35; }
.measure__warning.is-ok { background: var(--afos-normal-soft); color: #14532D; }
@media (max-width: 360px) { .measure-pair { grid-template-columns: 1fr; } }

.check-result { display: flex; gap: var(--afos-space-3); align-items: center; padding: var(--afos-space-4); border-radius: 14px; border: 2px solid var(--cr-fg); background: var(--cr-bg); }
.check-result .bi { font-size: 2rem; color: var(--cr-fg); flex: none; }
.check-result__title { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.25rem; }
.check-result__reasons { font-size: .9375rem; }
.check-result--normal    { --cr-fg: var(--afos-normal);    --cr-bg: var(--afos-normal-soft); }
.check-result--attention { --cr-fg: var(--afos-attention); --cr-bg: var(--afos-attention-soft); }
.check-result--critical  { --cr-fg: var(--afos-critical);  --cr-bg: var(--afos-critical-soft); }

.problem-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--afos-space-2); }
@media (min-width: 576px) { .problem-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.problem-grid__item { display: flex; min-width: 0; }
.problem-grid__item input { position: absolute; opacity: 0; pointer-events: none; }
.problem-grid__item label { flex: 1; min-width: 0; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 76px; padding: 6px; text-align: center; line-height: 1.2; font-weight: 600; font-size: .875rem; cursor: pointer; border: 1.5px solid var(--afos-line); border-radius: var(--afos-radius); background: var(--afos-surface); }
.problem-grid__item label .bi { font-size: 1.375rem; color: var(--afos-muted); }
.problem-grid__item input:checked + label { border-color: var(--afos-critical); background: var(--afos-critical-soft); }
.problem-grid__item input:checked + label .bi { color: var(--afos-critical); }
.problem-grid__item input:focus-visible + label { outline: 3px solid var(--afos-brand); outline-offset: 2px; }
.problem-grid.is-invalid .problem-grid__item label { border-color: #F3A7A7; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--afos-space-3); }
.report-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--afos-space-3); padding: var(--afos-space-3); background: var(--afos-surface); border: 1px solid var(--afos-line); border-left: 4px solid var(--rc-edge); border-radius: var(--afos-radius); color: inherit; text-decoration: none; }
a.report-card:hover { border-color: var(--afos-brand); border-left-color: var(--rc-edge); color: inherit; }
.report-card--critical { --rc-edge: var(--afos-critical); }
.report-card--attention { --rc-edge: var(--afos-attention); }
.report-card__photo { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; background: var(--afos-sunk); display: grid; place-items: center; font-size: 1.75rem; color: var(--afos-muted); }
.report-card__body { display: grid; gap: 3px; align-content: start; min-width: 0; }
.report-card__title { font-weight: 700; overflow-wrap: anywhere; }
.report-card__meta { font-size: .8125rem; color: var(--afos-muted); overflow-wrap: anywhere; }
.photo-grid--hero { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.action-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }

.health-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--afos-space-2); }
.health-tile { display: grid; justify-items: start; gap: 2px; padding: var(--afos-space-3); border-radius: var(--afos-radius); background: var(--afos-surface); border: 1px solid var(--afos-line); border-top: 4px solid var(--ht-fg); color: var(--afos-ink); text-decoration: none; }
a.health-tile:hover { border-color: var(--ht-fg); color: var(--afos-ink); }
.health-tile .bi { color: var(--ht-fg); font-size: 1.125rem; }
.health-tile__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.875rem; line-height: 1.1; }
.health-tile__label { font-size: .8125rem; color: var(--afos-muted); font-weight: 600; }
.health-tile--normal { --ht-fg: var(--afos-normal); }
.health-tile--attention { --ht-fg: var(--afos-attention); }
.health-tile--critical { --ht-fg: var(--afos-critical); }
.report-strip { display: flex; align-items: center; gap: var(--afos-space-3); min-height: 52px; padding: var(--afos-space-2) var(--afos-space-4); border-radius: var(--afos-radius); background: var(--afos-surface); border: 1px solid var(--afos-line); color: var(--afos-ink); text-decoration: none; }
a.report-strip:hover { border-color: var(--afos-brand); color: var(--afos-ink); }
.report-strip .bi-exclamation-triangle { color: var(--afos-attention); font-size: 1.25rem; }

[data-show-when] { transition: opacity .15s var(--afos-ease); }

/* ---------- Budidaya & panen (Phase 05) ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
.calc-result { display: flex; justify-content: space-between; align-items: baseline; gap: var(--afos-space-3); padding: var(--afos-space-3) var(--afos-space-4); border-radius: var(--afos-radius); background: var(--afos-brand-soft); min-width: 0; }
.calc-grid .calc-result { flex-direction: column; align-items: flex-start; gap: 2px; }
.calc-result__label { font-size: .875rem; font-weight: 600; color: var(--afos-muted); }
.calc-result__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--afos-brand-strong); overflow-wrap: anywhere; }
.calc-result.is-mismatch { background: var(--afos-critical-soft); }
.calc-result.is-mismatch .calc-result__value { color: #8A1616; }
.calc-result.is-match { background: var(--afos-normal-soft); }

.grade-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-3); }
@media (min-width: 576px) { .grade-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grade-grid__item { display: grid; gap: 4px; padding: var(--afos-space-2); border-radius: var(--afos-radius); border-top: 4px solid var(--gr-fg); background: var(--afos-sunk); min-width: 0; }
.grade-grid__pct { font-size: .8125rem; font-weight: 600; color: var(--afos-muted); text-align: center; }
.grade-grid__item--a, .grade-bar--a { --gr-fg: var(--afos-normal); }
.grade-grid__item--b, .grade-bar--b { --gr-fg: var(--afos-info); }
.grade-grid__item--c, .grade-bar--c { --gr-fg: var(--afos-attention); }
.grade-grid__item--reject, .grade-bar--reject { --gr-fg: var(--afos-critical); }

.harvest-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--afos-space-2); }
.harvest-hero > div { display: grid; gap: 2px; padding: var(--afos-space-3); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); min-width: 0; }
.harvest-hero__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.75rem; line-height: 1.1; overflow-wrap: anywhere; }
.harvest-hero__label { font-size: .8125rem; color: var(--afos-muted); font-weight: 600; }
.harvest-hero.is-voided { opacity: .55; }
.harvest-hero.is-voided .harvest-hero__value { text-decoration: line-through; }
@media (max-width: 380px) { .harvest-hero__value { font-size: 1.375rem; } }

.grade-bars { display: grid; gap: var(--afos-space-2); }
.grade-bar { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; align-items: center; gap: var(--afos-space-3); }
.grade-bar__label { font-weight: 600; font-size: .9375rem; }
.grade-bar__track { width: 100%; height: 10px; display: block; }
.grade-bar__bg { fill: var(--afos-sunk); }
.grade-bar__fill { fill: var(--gr-fg); }
.grade-bar__value { font-size: .875rem; color: var(--afos-muted); white-space: nowrap; }
@media (max-width: 400px) { .grade-bar { grid-template-columns: 4.5rem minmax(0, 1fr); } .grade-bar__value { grid-column: 2; } }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
@media (min-width: 992px) { .metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metric { display: grid; gap: 2px; align-content: start; padding: var(--afos-space-3); border-radius: var(--afos-radius); background: var(--afos-sunk); min-width: 0; }
.metric__label { font-size: .8125rem; font-weight: 600; color: var(--afos-muted); }
.metric__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; }
.metric__meta { font-size: .8125rem; color: var(--afos-muted); overflow-wrap: anywhere; }
.record-list .afos-disclosure { margin-top: 2px; }
/* ---------- Multi-kebun (Phase 08) ---------- */
.farm-switcher { display: flex; flex-wrap: wrap; align-items: center; gap: var(--afos-space-2); margin-bottom: var(--afos-space-4); }
.farm-switcher > .bi { color: var(--afos-brand); font-size: 1.125rem; }
.farm-label { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 var(--afos-space-3); padding: 4px 12px; border-radius: 999px; background: var(--afos-brand-soft); color: var(--afos-brand-strong); font-weight: 600; font-size: .875rem; }
.farm-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 6px; background: var(--afos-brand-soft); color: var(--afos-brand-strong); font-family: var(--afos-font-body); font-size: .75rem; font-weight: 700; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.report-card__title .farm-tag { margin: 0 6px 0 0; }
.yield-bar__farm { display: block; font-size: .6875rem; font-weight: 600; color: var(--afos-muted); line-height: 1.1; }

.farm-cards { display: grid; gap: var(--afos-space-3); }
@media (min-width: 768px) { .farm-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.farm-card { display: grid; gap: var(--afos-space-2); padding: var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-top: 4px solid var(--afos-normal); border-radius: var(--afos-radius); color: var(--afos-ink); text-decoration: none; min-width: 0; }
.farm-card--alert { border-top-color: var(--afos-critical); }
a.farm-card:hover { border-color: var(--afos-brand); color: var(--afos-ink); }
.farm-card__head { display: flex; align-items: center; gap: var(--afos-space-2); }
.farm-card__name { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.125rem; overflow-wrap: anywhere; }
.farm-card__health { display: flex; flex-wrap: wrap; gap: 4px var(--afos-space-3); font-size: .875rem; }
.dot-count { display: inline-flex; align-items: center; gap: 5px; color: var(--afos-muted); }
.dot-count::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dc); }
.dot-count > span { color: var(--afos-ink); font-weight: 700; }
.dot-count--normal { --dc: var(--afos-normal); }
.dot-count--attention { --dc: var(--afos-attention); }
.dot-count--critical { --dc: var(--afos-critical); }
.farm-card__kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--afos-space-2); margin: 0; }
@media (max-width: 420px) { .farm-card__kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.farm-card__kv dt { font-size: .75rem; font-weight: 600; color: var(--afos-muted); }
.farm-card__kv dd { margin: 0; font-family: var(--afos-font-display); font-weight: 600; font-size: 1.125rem; line-height: 1.2; }
.farm-card__kv dd small { font-family: var(--afos-font-body); font-size: .75rem; font-weight: 600; color: var(--afos-muted); }
.farm-card__foot { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: .875rem; }
/* ---------- PWA offline (Phase 07) ---------- */
.afos-conn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px; border-radius: 999px; font-size: .8125rem; font-weight: 700; white-space: nowrap; background: var(--afos-info-soft); color: #0B4F6E; text-decoration: none; }
.afos-conn[hidden] { display: none; }
.afos-conn .bi { font-size: 1rem; }
.afos-conn span + .bi { margin-left: 4px; }
.afos-conn.is-offline { background: var(--afos-inactive-soft); color: var(--afos-ink); }
.afos-conn.has-failed { background: var(--afos-attention-soft); color: #7A3A06; }
a.afos-conn:hover { filter: brightness(.96); }
.afos-conn--block { display: flex; justify-content: center; margin: 0 0 var(--afos-space-3); }
.afos-offline-shell .afos-topbar--plain .afos-mark { display: inline-flex; }
.afos-offline-shell .afos-content { padding-bottom: var(--afos-space-6); }
.afos-cache-banner { margin-bottom: var(--afos-space-3); }

.offline-hero { display: flex; gap: var(--afos-space-3); align-items: flex-start; padding: var(--afos-space-4); border-radius: 14px; border: 2px solid var(--afos-info); background: var(--afos-info-soft); }
.offline-hero > .bi { font-size: 2.25rem; color: var(--afos-info); flex: none; line-height: 1; }
.offline-hero__title { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.375rem; margin: 0 0 4px; }

.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--afos-space-2); }
.queue-item { display: flex; align-items: center; gap: var(--afos-space-3); padding: var(--afos-space-3) var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-left: 4px solid var(--q-edge); border-radius: var(--afos-radius); min-width: 0; }
.queue-item--pending { --q-edge: var(--afos-info); }
.queue-item--login { --q-edge: var(--afos-attention); }
.queue-item--failed { --q-edge: var(--afos-critical); }
.queue-item__icon { font-size: 1.375rem; color: var(--q-edge); flex: none; }
.queue-item__main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.queue-item__title { font-weight: 700; overflow-wrap: anywhere; }
.queue-item__meta { font-size: .8125rem; color: var(--afos-muted); overflow-wrap: anywhere; }
.queue-item__error { font-size: .875rem; color: #8A1616; font-weight: 600; overflow-wrap: anywhere; }
.queue-item__error[hidden] { display: none; }

.afos-toast { position: fixed; left: 50%; bottom: calc(var(--afos-nav-h) + var(--afos-space-4) + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1080; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--afos-ink); color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); transition: opacity .3s var(--afos-ease), transform .3s var(--afos-ease); }
.afos-toast.is-out { opacity: 0; transform: translate(-50%, 8px); }
@media (min-width: 992px) { .afos-toast { bottom: var(--afos-space-5); } }
/* ---------- Dashboard, laporan KPI, audit (Phase 06) ---------- */
.afos-narrow { max-width: 640px; }
.afos-search { position: relative; }
.afos-search .bi-search { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--afos-muted); pointer-events: none; }
.afos-search .form-control { padding-left: 42px; min-height: var(--afos-touch); }

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--afos-space-2); }
@media (min-width: 992px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { display: grid; gap: 2px; align-content: start; min-width: 0; padding: var(--afos-space-3) var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); }
.kpi__label { font-size: .8125rem; font-weight: 600; color: var(--afos-muted); }
.kpi__value { font-family: var(--afos-font-display); font-weight: 600; font-size: 1.875rem; line-height: 1.1; overflow-wrap: anywhere; }
.kpi__meta { font-size: .8125rem; color: var(--afos-muted); line-height: 1.35; overflow-wrap: anywhere; }
.kpi--alert { border-color: var(--afos-critical); box-shadow: inset 0 3px 0 var(--afos-critical); }
.kpi__flag { color: var(--afos-critical); font-weight: 700; white-space: nowrap; }
@media (max-width: 380px) { .kpi__value { font-size: 1.5rem; } }
.kpi-inline { font-family: var(--afos-font-display); font-size: 1.375rem; line-height: 1.2; }
.issue-row__icon { color: var(--afos-critical); font-size: 1.25rem; }

.yield-bars { display: grid; gap: 6px; }
.yield-bar { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr) 5.5rem; align-items: center; gap: var(--afos-space-3); min-height: 28px; }
.yield-bar__label { font-weight: 600; font-size: .875rem; }
.yield-bar__track { width: 100%; height: 12px; display: block; }
.yield-bar__fill { fill: var(--afos-brand); }
.yield-bar__value { font-size: .875rem; color: var(--afos-ink); text-align: right; white-space: nowrap; }

.trend-grid { display: grid; gap: var(--afos-space-3); }
@media (min-width: 768px) { .trend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.trend { margin: 0; min-width: 0; }
.trend__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--afos-space-2); margin-bottom: 4px; }
.trend__title { font-weight: 700; }
.trend__last { font-size: .875rem; color: var(--afos-muted); }
.trend__last strong { color: var(--afos-ink); font-family: var(--afos-font-display); font-size: 1.125rem; }
.trend__svg { width: 100%; height: auto; display: block; overflow: visible; }
.trend__grid { stroke: var(--afos-line); stroke-width: 1; }
.trend__tick { fill: var(--afos-muted); font-size: 9px; font-family: var(--afos-font-body); }
.trend__band { fill: var(--afos-normal-soft); }
.trend__line { fill: none; stroke: var(--afos-info); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend__dot { fill: var(--afos-info); stroke: var(--afos-surface); stroke-width: 2; }
.trend__dot--out { fill: var(--afos-critical); }
.trend__swatch { display: inline-block; width: 12px; height: 10px; border-radius: 2px; background: var(--afos-normal-soft); border: 1px solid var(--afos-normal); vertical-align: -1px; }
.trend__swatch--out { width: 10px; border-radius: 50%; background: var(--afos-critical); border-color: var(--afos-critical); }

.report-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--afos-space-2) var(--afos-space-3); padding: var(--afos-space-3); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); }
.report-toolbar__field { flex: 1 1 150px; min-width: 0; }
.report-toolbar__field .form-label { margin-bottom: 2px; }
.report-toolbar__actions { display: flex; flex-wrap: wrap; gap: var(--afos-space-2); }
.report-cards { display: grid; gap: var(--afos-space-2); }
.report-card-kpi { display: grid; gap: 4px; padding: var(--afos-space-3) var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); color: var(--afos-ink); text-decoration: none; }
a.report-card-kpi:hover { border-color: var(--afos-brand); color: var(--afos-ink); }
.report-card-kpi__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--afos-space-2); flex-wrap: wrap; }
.report-card-kpi__kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px var(--afos-space-3); margin: 4px 0 0; }
.report-card-kpi__kv dt { font-size: .75rem; font-weight: 600; color: var(--afos-muted); }
.report-card-kpi__kv dd { margin: 0; font-weight: 600; font-size: .9375rem; overflow-wrap: anywhere; }
@media (max-width: 360px) { .report-card-kpi__kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.report-table .afos-table td, .report-table .afos-table th { white-space: nowrap; }
.afos-table tfoot th, .afos-table tfoot td { padding: 10px 14px; background: var(--afos-sunk); font-weight: 700; border-top: 2px solid var(--afos-line); }

.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--afos-space-2); }
.audit-item { display: grid; gap: 6px; padding: var(--afos-space-3) var(--afos-space-4); background: var(--afos-surface); border: 1px solid var(--afos-line); border-radius: var(--afos-radius); min-width: 0; }
.audit-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--afos-space-2); }
.audit-item__label { font-weight: 600; overflow-wrap: anywhere; }
.audit-item__meta { font-size: .8125rem; color: var(--afos-muted); }
.audit-changes { display: grid; gap: 2px; margin: 0; font-size: .875rem; }
.audit-changes > div { display: grid; grid-template-columns: minmax(6rem, 30%) minmax(0, 1fr); gap: var(--afos-space-2); }
.audit-changes dt { font-weight: 600; color: var(--afos-muted); overflow-wrap: anywhere; }
.audit-changes dd { margin: 0; overflow-wrap: anywhere; }
.audit-changes__old { color: var(--afos-muted); text-decoration: line-through; }
.audit-changes__new { font-weight: 600; }

@media print {
  .afos-nav, .afos-topbar, .no-print, .skip-link, .afos-flash { display: none !important; }
  body, .afos-main, .afos-content { background: #fff !important; padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .report-cards { display: none !important; }
  .report-table { display: block !important; border: 0; overflow: visible; }
  .afos-table { font-size: 9pt; }
  .afos-table td, .afos-table th { padding: 4px 6px; }
  a { color: inherit !important; text-decoration: none !important; }
}
/* ---------- Gerak ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}
