:root {
  --ink: #173b32;
  --muted: #687b75;
  --green: #17634d;
  --pale: #eff5ee;
  --line: #e0e9e4;
  --gold: #ab7835;
  --white: #fff;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: #f3f7f5;
  font-size: 15px;
}
/* Shared touch targets and locally rendered icons keep the portal usable offline. */
button {
  min-height: 44px;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #61997c;
  outline-offset: 3px;
}
.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  vertical-align: middle;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: var(--green);
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 650;
  background: #eaf0e9;
  color: var(--ink);
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
.primary {
  background: var(--green);
  color: white;
}
.secondary {
  border: 1px solid var(--line);
  background: white;
}
.subtle {
  background: transparent;
  color: inherit;
  border: 1px solid #ffffff40;
}
.danger {
  color: #9b392c;
  background: #fbece7;
}
.wide {
  width: 100%;
}
.muted {
  color: var(--muted);
  line-height: 1.65;
}
.fine {
  font-size: 12px;
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 30px;
  letter-spacing: -1px;
  margin-bottom: 10px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.35px;
}
h3 {
  font-size: 16px;
}
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 20px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  padding: 11px 12px;
  margin-top: 7px;
  border: 1px solid #cad7cf;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  font-size: 16px;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #7dba92;
  outline-offset: 1px;
}
textarea {
  min-height: 80px;
  resize: vertical;
}
small {
  font-size: 12px;
}
.app-frame {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: #153f35;
  color: #ebf2eb;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  padding: 30px 22px;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.6px;
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: #b6c9bd;
  margin-top: 5px;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: #dfebc5;
  color: #214b35;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 750;
}
.workspace-label {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: #9db7a5;
  margin: 42px 12px 16px;
}
nav {
  display: grid;
  gap: 7px;
}
nav button {
  color: #c6d8ce;
  background: transparent;
  text-align: left;
  padding: 13px 14px;
  font-weight: 550;
}
nav button.active {
  background: #31594a;
  color: #fff;
}
nav .nav-icon {
  display: inline-block;
  width: 26px;
  opacity: 0.7;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 40px;
  font-size: 13px;
}
.sidebar-bottom p {
  margin-bottom: 5px;
}
.sidebar-bottom .muted {
  color: #aac4b6;
}
.sidebar-bottom button {
  margin-top: 15px;
  font-size: 12px;
}
.main-column {
  margin-left: 240px;
  width: calc(100% - 240px);
  display: flex;
  flex-direction: column;
}
.topbar {
  padding: 20px 36px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  gap: 16px;
  font-size: 13px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 15px;
}
.connection button {
  font-size: 12px;
}
#connection-state {
  color: var(--green);
}
main {
  padding: 32px 36px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
footer {
  padding: 24px 36px;
  color: #87968b;
  font-size: 11px;
}
footer span {
  padding: 0 8px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.8px;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 12px;
}
.page-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 26px;
}
.notice,
.error,
.success {
  border-radius: 9px;
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.notice {
  background: #fff5df;
  color: #735d29;
  border: 1px solid #f0e2c2;
}
.error {
  background: #fcebe5;
  color: #943326;
}
.success {
  background: #e6f3e7;
  color: #2e6541;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 26px 0;
}
.stat,
.card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 3px 15px #173b3203;
}
.stat {
  padding: 23px;
}
.stat strong {
  font-size: 32px;
  font-weight: 650;
  letter-spacing: -1px;
  display: block;
  margin: 12px 0 6px;
}
.stat .stat-label {
  font-size: 12px;
  color: var(--muted);
}
.stat small {
  font-size: 11px;
  color: #92a08f;
}
.card {
  padding: 24px;
  margin-bottom: 22px;
}
.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.profile-layout {
  align-items: start;
}
.profile-layout > * {
  min-width: 0;
}
.profile-card h2,
.profile-card dd,
.profile-notes {
  overflow-wrap: anywhere;
}
.profile-card h3 {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 26px;
}
.profile-card .details {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.profile-notes {
  white-space: pre-wrap;
}
.profile-status > .muted {
  margin-top: 18px;
}
.profile-status .notice p {
  margin: 8px 0 0;
}
.steps {
  display: grid;
  gap: 0;
}
.step {
  display: flex;
  gap: 14px;
  border-bottom: 1px solid #edf0eb;
  padding: 16px 0;
}
.step:last-child {
  border: 0;
}
.step-num {
  background: #edf3e7;
  color: var(--green);
  border-radius: 50%;
  height: 30px;
  width: 30px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 12px;
}
.step p {
  font-size: 13px;
  line-height: 1.6;
  margin: 4px 0 0;
  color: var(--muted);
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  text-align: left;
}
th {
  background: #f0f4ed;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #74806d;
  padding: 15px;
  white-space: nowrap;
}
td {
  padding: 16px 15px;
  border-top: 1px solid #edf1e9;
  vertical-align: top;
}
td small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
td button {
  font-size: 12px;
  padding: 7px 10px;
  margin: 0 5px 5px 0;
}
.badge {
  display: inline-block;
  font-size: 11px;
  border-radius: 30px;
  padding: 5px 9px;
  background: #eef1ed;
  white-space: nowrap;
}
.badge.approved {
  background: #e4f1df;
  color: #386d36;
}
.badge.submitted {
  background: #e5eef8;
  color: #396d9b;
}
.badge.needs_revision,
.badge.withdrawn {
  background: #fceee3;
  color: #a36431;
}
.badge.local {
  background: #fff2cc;
  color: #836829;
}
.filter-row {
  display: flex;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-row label {
  min-width: 180px;
  flex: 1;
  margin: 0;
}
.filter-row button {
  height: 43px;
}
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  line-height: 1.8;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.form-grid .full {
  grid-column: 1/-1;
}
dialog {
  border: 0;
  border-radius: 14px;
  width: min(800px, 95vw);
  max-height: 92vh;
  padding: 30px;
  color: var(--ink);
  box-shadow: 0 20px 100px #102b3340;
}
dialog::backdrop {
  background: #173b3290;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 20px;
}
.close {
  background: #f1f3ee;
  padding: 5px 12px;
  font-size: 20px;
}
.dialog-actions {
  position: sticky;
  bottom: -30px;
  background: white;
  border-top: 1px solid var(--line);
  padding: 18px 0 0;
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.crop-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.crop-row button {
  margin-bottom: 17px;
}
.map {
  height: 450px;
  border-radius: 10px;
  background: #e6eddf;
}
.map-picker {
  height: 230px;
  margin-bottom: 16px;
}
.map-help {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(130deg, #e6efdf 0, #f9faf6 65%);
}
.login-card {
  width: min(450px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 38px;
  box-shadow: 0 20px 70px #264e3610;
}
.login-card .brand-mark {
  margin-bottom: 24px;
}
.login-card h1 {
  font-size: 27px;
}
.login-card form {
  margin-top: 25px;
}
.back-link {
  display: block;
  margin: 24px 0;
  font-size: 13px;
  text-decoration: none;
}
.details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.details dt {
  color: var(--muted);
  font-size: 12px;
}
.details dd {
  margin: 6px 0;
  font-size: 14px;
}
details {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.history-data {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}
.toolbar-note {
  font-size: 12px;
  color: var(--muted);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 200px;
    padding: 25px 15px;
  }
  .main-column {
    margin-left: 200px;
    width: calc(100% - 200px);
  }
  main {
    padding: 25px;
  }
}

/* Portal workspace */
.sidebar {
  background: #103e31;
  overflow-y: auto;
}
.sidebar nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-size: 13px;
}
.sidebar nav button.active {
  background: #ffffff13;
  box-shadow: inset 3px 0 #cbe993;
}
.sidebar nav .icon {
  opacity: 0.85;
  width: 20px;
}
.brand-mark {
  background: #d9eead;
}
.topbar {
  background: #ffffffed;
  min-height: 82px;
}
.topbar-brand {
  min-width: 0;
}
#portal-title {
  font-size: 13px;
  color: var(--muted);
}
.mobile-brand-mark,
.mobile-brand-name {
  display: none;
}
.connection {
  gap: 18px;
}
#connection-state {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12px;
}
#connection-state::before,
.live-dot {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58a779;
  display: inline-block;
  flex-shrink: 0;
}
#connection-state.offline {
  color: #987039;
}
#connection-state.offline::before {
  background: #c18b3d;
}
#sync-button {
  display: flex;
  align-items: center;
  gap: 8px;
}
#sync-button .icon {
  width: 18px;
}
.sample-note {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #766b53;
  margin-bottom: 22px;
  line-height: 1.5;
}
.sample-note span {
  white-space: nowrap;
  border: 1px solid #ddceb0;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1px;
  border-radius: 5px;
}
#message:empty {
  display: none;
}
#mobile-nav {
  display: none;
}
#navigation-sheet {
  max-width: 460px;
}
.account-chip {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #f1f6f2;
  padding: 18px;
  border-radius: 14px;
  margin-bottom: 20px;
}
.account-chip strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.account-chip small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.sheet-links {
  display: grid;
  gap: 5px;
}
.sheet-links button {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  padding: 14px 10px;
  background: transparent;
}
.sheet-links button .icon:last-child {
  width: 16px;
  margin-left: auto;
  color: #8fa497;
}
.sheet-links button.active {
  background: #f0f6ed;
  color: #17634d;
}
.logout-button {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  color: #955043;
  border-top: 1px solid var(--line);
  border-radius: 0;
  margin-top: 20px;
  width: 100%;
  padding: 18px 10px 0;
}

/* Poktan home */
.home-hero {
  padding: 32px;
  border-radius: 24px;
  background: linear-gradient(115deg, #144835, #236951);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 700;
  border: 1px solid #ffffff25;
  border-radius: 30px;
  padding: 7px 10px;
  position: relative;
  z-index: 1;
}
.hero-tag .live-dot {
  background: #d1e99b;
  width: 5px;
  height: 5px;
}
.hero-welcome {
  margin: 26px 0 8px;
  font-size: 12px;
  color: #c1d7ca;
}
.home-hero h1 {
  max-width: 650px;
  font-size: 34px;
  letter-spacing: -1.1px;
  line-height: 1.16;
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
}
.home-hero > p:not(.hero-welcome) {
  font-size: 14px;
  line-height: 1.6;
  color: #dce8df;
  position: relative;
  z-index: 1;
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 25px;
  position: relative;
  z-index: 1;
}
.hero-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  font-size: 13px;
}
.hero-primary {
  background: #d9efaa;
  color: #143f30;
}
.hero-secondary {
  background: #ffffff0b;
  border: 1px solid #ffffff35;
  color: #fff;
}
.hero-decoration {
  position: absolute;
  right: -20px;
  top: 22px;
  color: #e3f2d4;
  opacity: 0.08;
  transform: rotate(-18deg);
  pointer-events: none;
}
.hero-decoration .icon {
  width: 300px;
  height: 300px;
  stroke-width: 0.65;
}
.home-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}
.home-stats button {
  display: grid;
  grid-template-columns: 1fr auto;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  padding: 21px;
  border-radius: 18px;
}
.home-stats .icon:first-child {
  grid-column: 1;
  color: #729887;
  margin-bottom: 14px;
}
.home-stats strong {
  grid-column: 1;
  font-size: 34px;
  letter-spacing: -1.2px;
  font-weight: 650;
}
.home-stats span {
  grid-column: 1;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.home-stats .icon:last-child {
  grid-column: 2;
  grid-row: 2;
  width: 17px;
  color: #82998b;
  align-self: center;
}
.home-section-heading h2 {
  font-size: 18px;
  margin-bottom: 16px;
}
.home-section-heading .eyebrow {
  font-size: 9px;
  color: #769482;
  margin-bottom: 7px;
}
.home-shortcuts {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 0 20px;
}
.shortcut {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  text-align: left;
  border-bottom: 1px solid #eef2ee;
  border-radius: 0;
  padding: 21px 0;
  background: none;
}
.shortcut:last-child {
  border-bottom: 0;
}
.shortcut > span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.shortcut strong {
  font-size: 14px;
  display: block;
}
.shortcut small {
  color: var(--muted);
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.shortcut > .icon {
  width: 17px;
  color: #8ba393;
}
.shortcut-icon {
  display: grid;
  place-items: center;
  background: #eaf3e6;
  color: #568761;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  flex-shrink: 0;
}
.shortcut-icon.amber {
  background: #fcf3df;
  color: #a88a46;
}
.shortcut-icon.blue {
  background: #eaf1f8;
  color: #6691af;
}
.field-tip {
  background: #eaf1e4;
  border-radius: 18px;
  padding: 21px;
  display: flex;
  gap: 14px;
  margin-top: 20px;
}
.field-tip > .icon {
  margin-top: 2px;
  color: #557d47;
}
.field-tip strong {
  font-size: 13px;
}
.field-tip p {
  font-size: 12px;
  line-height: 1.7;
  color: #627860;
  margin: 7px 0 0;
}
.home-updated {
  font-size: 10px;
  color: #81948a;
  text-align: center;
  margin: 18px 0 0;
}

/* Forms and device location */
dialog {
  border-radius: 22px;
  max-height: 92dvh;
  overscroll-behavior: contain;
}
.dialog-head {
  background: #fff;
}
.dialog-head .eyebrow {
  font-size: 9px;
  color: #759180;
}
.close {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.form-section {
  display: flex;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 24px 0 20px;
  margin-top: 8px;
}
.form-section:first-child {
  border-top: 0;
  padding-top: 4px;
  margin-top: 0;
}
.form-section > span {
  border: 1px solid #d9e6d4;
  background: #f0f6eb;
  color: #6a8b59;
  font-size: 11px;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.form-section h3 {
  margin: 0;
  font-size: 16px;
}
.form-section p {
  color: var(--muted);
  font-size: 12px;
  margin: 5px 0 0;
  line-height: 1.5;
}
.gps-card {
  border: 1px solid #d6e7cd;
  background: #f0f7ea;
  border-radius: 17px;
  padding: 20px;
  margin-bottom: 20px;
}
.gps-intro {
  display: flex;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}
.gps-intro > .icon {
  color: #598855;
  margin-top: 3px;
}
.gps-intro strong {
  font-size: 15px;
}
.gps-intro p {
  font-size: 12px;
  line-height: 1.6;
  margin: 5px 0 0;
  color: #6b8065;
}
#gps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}
#gps[aria-busy="true"] .icon {
  animation: location-search 2s linear infinite;
}
@keyframes location-search {
  to {
    transform: rotate(360deg);
  }
}
.gps-note {
  font-size: 12px;
  line-height: 1.7;
  color: #6a7f66;
  margin: 14px 0 0;
}
.gps-note[data-status="error"] {
  color: #a04432;
}
.gps-note[data-status="warning"] {
  color: #8a6726;
}
.gps-note[data-status="success"] {
  color: #21664b;
}
#gps-time {
  font-size: 10px;
  margin: 8px 0 0;
}
#gps-time:empty {
  display: none;
}
.optional-notes {
  margin-top: 20px;
}
.optional-notes label {
  margin-top: 16px;
}
.optional-notes summary {
  min-height: 44px;
  padding: 12px 0;
  color: var(--muted);
}
.crop-row {
  background: #f7f9f5;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.crop-row label {
  min-width: 0;
  font-size: 12px;
}
.crop-row select {
  min-width: 0;
}
.dialog-actions {
  gap: 10px;
  padding: 16px 0;
  z-index: 1100;
}
.dialog-actions button {
  min-height: 50px;
}
.profile-card .details dd,
.details dd {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .app-frame {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .main-column {
    margin: 0;
    width: 100%;
    min-height: 100dvh;
  }
  .topbar {
    padding: max(14px, env(safe-area-inset-top)) 20px 14px;
    min-height: 78px;
    position: sticky;
    top: 0;
    z-index: 1100;
    backdrop-filter: blur(12px);
  }
  .topbar-brand {
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .mobile-brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    background: #143e31;
    color: #d5ecaa;
    border-radius: 12px;
    font-size: 21px;
    font-weight: 750;
  }
  .mobile-brand-name {
    display: block;
    font-size: 11px;
    letter-spacing: 1px;
    margin-bottom: 4px;
  }
  #portal-title {
    display: block;
    font-size: 10px;
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .connection {
    gap: 10px;
  }
  #connection-state {
    font-size: 10px;
    gap: 5px;
  }
  #connection-state::before {
    width: 6px;
    height: 6px;
  }
  #sync-button {
    padding: 10px;
    border-radius: 12px;
    background: #f4f7f3;
    border: 0;
    min-width: 44px;
    justify-content: center;
  }
  .sync-label {
    display: none;
  }
  #queue-count {
    font-size: 9px;
  }
  #queue-count:empty {
    display: none;
  }
  main {
    padding: 20px;
    max-width: 760px;
  }
  footer {
    padding: 24px 20px calc(106px + env(safe-area-inset-bottom));
    font-size: 10px;
    text-align: center;
    line-height: 1.8;
  }
  #mobile-nav {
    position: fixed;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    z-index: 1200;
    margin: 0;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: #fffffffa;
    border-top: 1px solid #e3ebe5;
    box-shadow: 0 -8px 32px #173b3205;
    backdrop-filter: blur(12px);
  }
  #mobile-nav button {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-radius: 13px;
    padding: 7px 3px;
    color: #91a297;
    font-size: 10px;
    font-weight: 600;
    min-height: 54px;
    text-align: center;
    background: transparent;
  }
  #mobile-nav button.active {
    color: #1a654a;
    background: #eff6e8;
  }
  #mobile-nav .icon {
    width: 22px;
    height: 22px;
  }
  #navigation-sheet {
    width: 100%;
    max-width: 550px;
    margin: auto auto 0;
    max-height: 88dvh;
    border-radius: 25px 25px 0 0;
    padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
  }
  #navigation-sheet .dialog-head {
    padding: 0;
  }
  .page-heading {
    display: block;
    margin-top: 2px;
  }
  .page-heading h1 {
    font-size: 27px;
    line-height: 1.2;
  }
  .page-heading .muted {
    font-size: 13px;
  }
  .page-heading > button {
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
  }
  .sample-note {
    font-size: 10px;
    gap: 8px;
    margin-bottom: 17px;
  }
  .home-hero {
    border-radius: 22px;
    padding: 25px;
  }
  .home-hero h1 {
    font-size: 29px;
  }
  .home-hero > p:not(.hero-welcome) {
    font-size: 13px;
  }
  .hero-welcome {
    margin-top: 23px;
    font-size: 11px;
  }
  .hero-actions {
    gap: 9px;
    margin-top: 22px;
  }
  .hero-actions button {
    flex: 1;
    padding: 12px 9px;
    font-size: 12px;
    gap: 7px;
  }
  .hero-actions .icon {
    width: 18px;
    height: 18px;
  }
  .hero-decoration {
    right: -95px;
    top: 5px;
  }
  .home-stats {
    gap: 12px;
    margin-top: 14px;
  }
  .home-stats button {
    padding: 19px;
  }
  .home-stats strong {
    font-size: 32px;
  }
  .home-stats span {
    font-size: 11px;
  }
  .home-shortcuts {
    padding: 0 16px;
  }
  .shortcut {
    gap: 12px;
    padding: 18px 0;
  }
  .shortcut strong {
    font-size: 13px;
  }
  .shortcut small {
    font-size: 11px;
  }
  .field-tip {
    padding: 19px;
  }
  .filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .filter-row label {
    min-width: 0;
    font-size: 12px;
  }
  .filter-row label:first-child {
    grid-column: 1/-1;
  }
  .filter-row label:only-child {
    grid-column: 1/-1;
  }
  .record-table,
  .queue-table {
    border: 0;
    background: none;
    overflow: visible;
  }
  .record-table table,
  .record-table tbody,
  .queue-table table,
  .queue-table tbody {
    display: block;
    width: 100%;
  }
  .record-table thead,
  .queue-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .record-table tbody tr,
  .queue-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border: 1px solid var(--line);
    background: white;
    border-radius: 17px;
    padding: 19px;
    margin-bottom: 13px;
    gap: 12px;
  }
  .record-table td,
  .queue-table td {
    display: block;
    padding: 0;
    border: 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .record-name strong {
    font-size: 16px;
  }
  .record-name small {
    margin-top: 6px;
  }
  .record-table .record-region {
    font-size: 12px;
    color: #64806c;
  }
  .record-region small {
    display: inline;
    font-size: 12px;
  }
  .record-region small::before {
    content: " · ";
  }
  .record-actions {
    border-top: 1px solid #eff3ef !important;
    padding-top: 14px !important;
  }
  .record-actions button,
  .queue-table td button {
    margin: 0 4px 4px 0;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .record-actions button:last-child {
    background: #eaf3e3;
    color: #34673f;
  }
  .queue-table td:first-child {
    font-weight: 650;
    font-size: 15px;
  }
  .queue-table td:nth-child(2) {
    color: #74856f;
    font-size: 12px;
  }
  .stats {
    gap: 12px;
  }
  .stat {
    padding: 18px;
  }
  .stat strong {
    font-size: 27px;
  }
  .card {
    padding: 21px;
  }
  .details,
  .profile-card .details {
    grid-template-columns: 1fr;
  }
  .map {
    height: 350px;
  }
  .map-picker {
    height: 220px;
  }
  #editor {
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: max(20px, env(safe-area-inset-top)) 20px
      max(20px, env(safe-area-inset-bottom));
  }
  #editor .dialog-head {
    position: sticky;
    top: calc(-1 * max(20px, env(safe-area-inset-top)));
    z-index: 1200;
    padding: 16px 0 14px;
    margin-top: -20px;
    border-bottom: 1px solid var(--line);
  }
  #editor .dialog-head h2 {
    font-size: 20px;
    margin-bottom: 0;
  }
  .dialog-head .eyebrow {
    margin-bottom: 6px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  input,
  select,
  textarea {
    scroll-margin-top: 115px;
  }
  .form-section {
    padding-top: 22px;
  }
  .crop-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
  }
  .crop-row label:first-child {
    grid-column: 1/-1;
  }
  .crop-row button {
    grid-column: 2;
    justify-self: end;
    min-width: 44px;
    margin: 0;
  }
  .dialog-actions {
    bottom: calc(-1 * max(20px, env(safe-area-inset-bottom)));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 8px;
  }
  .dialog-actions button {
    font-size: 12px;
    padding: 10px;
    line-height: 1.4;
  }
  .table-wrap {
    max-width: 100%;
  }
  .login-card {
    padding: 28px;
  }
  .login-body {
    padding: 20px;
  }
}
@media (max-width: 360px) {
  main {
    padding: 16px;
  }
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
  #connection-state {
    font-size: 0;
    gap: 0;
  }
  #connection-state::before {
    width: 8px;
    height: 8px;
  }
  .home-hero {
    padding: 21px;
  }
  .hero-actions {
    flex-direction: column;
  }
}
@media (prefers-reduced-motion: reduce) {
  #gps[aria-busy="true"] .icon {
    animation: none;
  }
}

body:has(dialog[open]) {
  overflow: hidden;
}

/* Penyuluh and provincial field admin workspaces. */
.admin-hero {
  background: linear-gradient(115deg, #153f45, #296967);
}
.staff-scope {
  display: flex;
  align-items: center;
  gap: 8px;
}
.staff-scope .icon {
  width: 18px;
  height: 18px;
}
.staff-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 30px;
}
.staff-metrics button {
  display: grid;
  grid-template-columns: 1fr auto;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.staff-metrics .metric-icon {
  grid-column: 2;
  grid-row: 1;
  color: #709885;
}
.staff-metrics strong {
  font-size: 32px;
  font-weight: 650;
  grid-row: 1;
}
.staff-metrics button > span:last-child {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-top: 7px;
}
.staff-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}
.section-with-action {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  padding: 0;
  color: var(--green);
  font-size: 12px;
}
.text-button .icon {
  width: 16px;
}
.staff-entry-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.staff-entry-actions button {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.staff-empty {
  border: 1px dashed #cbdccd;
  border-radius: 18px;
  background: #f9fbf8;
  padding: 30px 24px;
  text-align: center;
}
.staff-empty > .icon {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  color: #89a88b;
}
.staff-empty h3 {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.staff-empty p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}
.review-preview {
  display: grid;
  gap: 14px;
}
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.review-grid > .staff-empty {
  grid-column: 1/-1;
}
.review-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 22px;
}
.review-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}
.kind-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #66826f;
}
.kind-label .icon {
  width: 18px;
  height: 18px;
}
.review-item h3 {
  font-size: 17px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  margin-bottom: 8px;
}
.review-item p {
  font-size: 12px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}
.review-item-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf2ee;
  padding-top: 16px;
  margin-top: 18px;
}
.review-item-bottom > span {
  font-size: 11px;
  color: var(--muted);
}
.review-item-bottom button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
}
.review-item-bottom .icon {
  width: 16px;
  height: 16px;
}
.review-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  background: #eaf0eb;
  border-radius: 15px;
  margin-bottom: 24px;
  max-width: 520px;
}
.review-tabs button {
  flex: 1;
  background: transparent;
  color: #6a7f72;
  font-size: 13px;
  padding: 12px 10px;
}
.review-tabs button[aria-pressed="true"] {
  background: #fff;
  color: var(--green);
  box-shadow: 0 2px 8px #143e3109;
}
.review-tabs span {
  display: inline-block;
  border-radius: 6px;
  background: #edf3e7;
  padding: 2px 6px;
  margin-left: 3px;
  font-size: 11px;
}
.review-filters label:first-child {
  flex: 2;
}
.result-count {
  font-size: 12px;
  color: var(--muted);
  margin: 22px 0 16px;
}
.accounts-table td {
  overflow-wrap: anywhere;
}
.accounts-table .account-identity strong {
  font-size: 14px;
}
.account-actions button,
#add-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.account-actions button {
  white-space: nowrap;
}
.account-actions .icon,
#add-account .icon {
  width: 18px;
  height: 18px;
}
.review-decision {
  margin: 24px 0 18px;
  background: #f5f9f0;
  border-color: #dce8cf;
}
.review-decision textarea {
  min-height: 110px;
}
.review-decision .actions button {
  flex: 1;
}
.crop-summary {
  margin: 20px 0;
}
#account-error:empty,
#detail-error:empty {
  display: none;
}
.account-save button {
  width: 100%;
}

@media (max-width: 1100px) {
  .staff-home-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .staff-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .staff-hero .hero-actions {
    flex-direction: column;
  }
  .staff-metrics {
    gap: 12px;
    margin-top: 14px;
  }
  .staff-metrics button {
    padding: 18px;
  }
  .staff-metrics strong {
    font-size: 29px;
  }
  .staff-metrics button > span:last-child {
    font-size: 11px;
  }
  .staff-home-grid {
    gap: 28px;
  }
  .staff-entry-actions {
    flex-direction: column;
  }
  .staff-entry-actions button {
    min-height: 48px;
  }
  .review-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .review-item {
    padding: 19px;
  }
  .review-item-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .review-item-bottom button {
    min-height: 48px;
  }
  .review-tabs {
    gap: 4px;
  }
  .review-tabs button {
    font-size: 12px;
    padding: 11px 5px;
  }
  .review-filters label {
    grid-column: 1/-1;
  }
  .review-decision {
    padding: 20px;
  }
  .review-decision .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .review-decision .actions button {
    min-height: 50px;
  }
  .account-save {
    grid-template-columns: minmax(0, 1fr);
  }
  .accounts-table,
  .summary-table,
  .history-table,
  .crop-summary {
    border: 0;
    background: none;
    overflow: visible;
  }
  :is(.accounts-table, .summary-table, .history-table, .crop-summary)
    :is(table, tbody) {
    display: block;
    width: 100%;
  }
  :is(.accounts-table, .summary-table, .history-table, .crop-summary) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  :is(.accounts-table, .summary-table, .history-table, .crop-summary) tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 19px;
    margin-bottom: 13px;
  }
  :is(.accounts-table, .summary-table, .history-table, .crop-summary) td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  :is(.accounts-table, .summary-table, .history-table, .crop-summary)
    td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
  }
  .accounts-table .account-identity strong {
    font-size: 16px;
  }
  .account-actions {
    border-top: 1px solid #eef2ee !important;
    padding-top: 14px !important;
  }
  .account-actions button {
    width: 100%;
    min-height: 48px;
  }
}

/* Harvest entry and history share the responsive portal cards and dialog. */
.production-heading { margin: 28px 0 16px; }
.production-card { min-width: 0; overflow-wrap: anywhere; }
.production-card h3 { margin: 14px 0 8px; }
.production-amount { display: block; font-size: 1.7rem; color: #176b4b; margin: 10px 0; }
.production-year { display: flex; align-items: center; gap: 10px; padding: 12px 0; }
.production-year input { width: 22px; min-height: 22px; flex: 0 0 22px; }
.production-totals { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 16px; }
.production-totals strong, .production-totals span { display: block; }
.production-totals strong { color: #176b4b; font-size: 1.8rem; }
.production-history { margin-top: 20px; display: grid; gap: 12px; }
#production-land-info p { margin: 8px 0 0; }
