:root {
  --green-950: #0f2f1f;
  --green-900: #173f2b;
  --green-800: #1f5c3a;
  --green-700: #2f7d50;
  --green-600: #3d9662;
  --green-100: #dff3e5;
  --green-75: #edf8ef;
  --cream: #fff9e8;
  --cream-2: #fbf4da;
  --soil: #9a6b3d;
  --text: #17251c;
  --muted: #5f705f;
  --danger: #ba3a33;
  --white: #ffffff;
  --shadow: 0 18px 55px rgba(20, 60, 34, 0.15);
  --soft-shadow: 0 10px 30px rgba(20, 60, 34, 0.10);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: linear-gradient(180deg, #eff9f1 0%, #f8f5e7 100%); }

body {
  margin: 0;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(140, 192, 119, 0.32), transparent 32rem),
    linear-gradient(180deg, #f1faf2 0%, #fffdf3 65%, #edf7ee 100%);
  line-height: 1.35;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px 28px;
}

.hero-card, .panel, .result-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card {
  background: linear-gradient(150deg, var(--green-900), var(--green-700));
  color: var(--white);
  padding: 22px;
  min-height: 230px;
}

.hero-pattern {
  position: absolute;
  inset: auto -60px -100px auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,.15) 0 4px, transparent 5px),
    radial-gradient(circle, rgba(255,246,185,.22) 0 3px, transparent 4px);
  background-size: 26px 26px, 39px 39px;
  opacity: .85;
}

.topbar, .section-head, .result-header, .action-row, .detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 31px;
}

.eyebrow {
  margin: 0 0 3px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: 12px;
  color: var(--green-700);
}
.hero-card .eyebrow, .eyebrow.light { color: rgba(255,255,255,.74); }

h1, h2, h3 { margin: 0; line-height: 1.05; }
h1 { font-size: clamp(30px, 8vw, 48px); letter-spacing: -.04em; }
h2 { font-size: clamp(22px, 6vw, 30px); letter-spacing: -.03em; }
h3 { font-size: 21px; margin-bottom: 12px; }
.hero-copy { position: relative; max-width: 550px; margin: 22px 0 18px; font-size: 18px; color: rgba(255,255,255,.91); }

.icon-btn, .close-btn {
  border: 0;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 22px;
}

.mini-stats {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
}
.mini-stats div {
  border-radius: 20px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  padding: 14px;
}
.mini-stats span { display: block; font-size: 28px; font-weight: 900; }
.mini-stats small { color: rgba(255,255,255,.76); font-weight: 700; }

main { display: grid; gap: 14px; margin-top: 14px; }
.panel {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(47, 125, 80, .12);
  padding: 18px;
}
.section-head { padding-bottom: 14px; border-bottom: 1px solid rgba(47, 125, 80, .12); margin-bottom: 14px; }
.section-head.no-border { border-bottom: 0; padding-bottom: 0; }

.weight-list { display: grid; gap: 10px; }
.weight-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  align-items: center;
}
.weight-row label {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: center;
  border-radius: 18px;
  background: var(--green-75);
  border: 1px solid rgba(47, 125, 80, .16);
  padding: 8px;
}
.weight-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 14px;
  color: var(--green-900);
  background: #d8efdc;
  font-weight: 900;
  font-size: 17px;
}
.weight-input, .field-card input, .full-input, .full-textarea {
  width: 100%;
  border: 1px solid rgba(47, 125, 80, .24);
  background: #fff;
  color: var(--text);
  outline: 0;
  border-radius: 15px;
  padding: 13px 14px;
  font-size: 21px;
  font-weight: 800;
}
.weight-input:focus, .field-card input:focus, .full-input:focus, .full-textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 4px rgba(61, 150, 98, .16);
}
.row-delete {
  border: 0;
  border-radius: 14px;
  height: 50px;
  background: #f3e3de;
  color: var(--danger);
  font-size: 24px;
  font-weight: 900;
}

.wrap { flex-wrap: wrap; }
.action-row { margin-top: 14px; }
.primary-btn, .secondary-btn, .danger-btn, .small-btn, .print-btn {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 0 16px;
  font-weight: 900;
  letter-spacing: -.01em;
}
.primary-btn { background: linear-gradient(135deg, var(--green-700), var(--green-600)); color: #fff; box-shadow: var(--soft-shadow); }
.secondary-btn { background: var(--cream-2); color: var(--green-900); }
.danger-btn { background: #f4dfda; color: var(--danger); }
.small-btn { min-height: 40px; border-radius: 14px; padding: 0 13px; }
.ghost { background: var(--green-75); color: var(--green-800); }
.light-btn { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.22); }
.print-btn { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.full { width: 100%; margin-top: 12px; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 15px; }

.form-grid, .settings-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.field-card {
  display: block;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--green-75);
  border: 1px solid rgba(47, 125, 80, .13);
}
.field-card span, .plain-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
  color: var(--green-950);
  font-size: 18px;
}
.field-card small { display: block; color: var(--muted); margin-top: 7px; font-size: 15px; }
.field-card em { font-style: normal; font-size: 14px; color: var(--muted); }
.optional { background: #fff8de; }

.result-card {
  background: linear-gradient(160deg, var(--green-900), #1e6b42 65%, #28764b);
  color: #fff;
  padding: 18px;
}
.result-header { margin-bottom: 14px; }
.summary-list { display: grid; gap: 9px; }
.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
}
.summary-item span { color: rgba(255,255,255,.78); font-weight: 800; font-size: 16px; }
.summary-item strong { font-size: clamp(23px, 7vw, 35px); white-space: nowrap; }
.muted-line { background: rgba(255,255,255,.08); }
.muted-line strong { font-size: 22px; }
.harvest { background: rgba(255,249,232,.18); }
.net-line { background: #fff7ce; color: var(--green-950); }
.net-line span { color: #415d3e; }
.bonus-line { background: rgba(255, 237, 170, .16); }
.detail-actions { justify-content: flex-start; margin-top: 14px; flex-wrap: wrap; }
.detail-box {
  margin-top: 14px;
  background: rgba(255,255,255,.96);
  color: var(--text);
  border-radius: 22px;
  padding: 16px;
}
.detail-box p { margin: 0 0 10px; }
.detail-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.detail-table th, .detail-table td { border-bottom: 1px solid #dfeddf; padding: 9px 6px; text-align: left; }
.detail-table th { color: var(--green-900); }

.about-content {
  color: #344739;
  font-size: 17px;
  white-space: pre-line;
}
.footer-note {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 5px 0;
  color: rgba(20, 60, 34, .45);
  font-size: 11px;
}
.visitor-count { white-space: nowrap; }

.modal.hidden, .hidden { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  padding: 18px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 19, 10, .58);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  background: #fff;
  border-radius: 28px;
  padding: 20px;
  box-shadow: 0 26px 80px rgba(0,0,0,.25);
}
.small-modal { width: min(430px, 100%); }
.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--green-75);
  color: var(--green-900);
}
.modal-card h2 { padding-right: 50px; margin-bottom: 10px; }
.modal-card p { color: var(--muted); }
.full-textarea { min-height: 170px; resize: vertical; font-size: 17px; font-weight: 600; line-height: 1.45; }
.plain-label { margin-top: 14px; }
.backend-box {
  margin-top: 16px;
  padding: 12px;
  border-radius: 16px;
  background: var(--green-75);
  border: 1px solid rgba(47,125,80,.13);
}
.backend-box summary { font-weight: 900; color: var(--green-900); cursor: pointer; }
.sticky-actions {
  position: sticky;
  bottom: -20px;
  background: linear-gradient(180deg, rgba(255,255,255,.3), #fff 35%);
  padding: 16px 0 2px;
}
.modal-msg { min-height: 22px; font-weight: 800; }

@media (min-width: 680px) {
  .form-grid, .settings-grid { grid-template-columns: 1fr 1fr; }
  .modal { place-items: center; }
}

@media (max-width: 420px) {
  .app-shell { padding-left: 10px; padding-right: 10px; }
  .hero-card, .panel, .result-card { border-radius: 22px; }
  .hero-card, .panel, .result-card { padding: 15px; }
  .brand-mark { width: 50px; height: 50px; border-radius: 17px; }
  .mini-stats span { font-size: 24px; }
  .summary-item { align-items: flex-start; flex-direction: column; gap: 4px; }
  .summary-item strong { font-size: 30px; }
  .weight-row label { grid-template-columns: 68px 1fr; }
  .primary-btn, .secondary-btn, .danger-btn { width: 100%; }
}

@media print {
  body { background: #fff; }
  .hero-card, .input-panel, .worker-panel, .about-panel, .footer-note, .detail-actions, .print-btn, .icon-btn { display: none !important; }
  .app-shell { width: 100%; padding: 0; }
  .result-card { color: #000; background: #fff; box-shadow: none; border-radius: 0; padding: 0; }
  .summary-item { color: #000; background: #fff; border: 1px solid #ddd; break-inside: avoid; }
  .summary-item span, .net-line span { color: #333; }
  .detail-box { display: block !important; color: #000; background: #fff; padding: 0; }
}

/* Revisi v1.1 - alur HITUNG, bonus popup, dan Tentang Aplikasi tombol bawah */
.form-grid.single { grid-template-columns: 1fr !important; }

.calculate-panel {
  position: sticky;
  bottom: 10px;
  z-index: 20;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255, 253, 243, .86);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(47, 125, 80, .15);
  box-shadow: var(--soft-shadow);
}
.big-calculate-btn {
  border: 0;
  width: 100%;
  min-height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, #14572f, #32915a);
  color: #fff;
  font-size: clamp(26px, 8vw, 38px);
  font-weight: 1000;
  letter-spacing: .04em;
  box-shadow: 0 16px 35px rgba(31, 92, 58, .28);
}
.calculate-msg {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.result-card { scroll-margin-top: 12px; }
.summary-item.highlight-pay {
  background: linear-gradient(135deg, #fff7c6, #fff2a6);
  color: var(--green-950);
  border: 2px solid rgba(255, 244, 164, .7);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.summary-item.highlight-pay span { color: #31533a; font-size: 18px; }
.summary-item.highlight-pay strong { color: #12351f; font-size: clamp(30px, 9vw, 43px); }
.summary-item.machine-main {
  background: linear-gradient(135deg, #e5fff0, #c9f3d8);
}
.summary-item.bonus-focus {
  background: #fff9dd;
  color: var(--green-950);
  border: 2px solid rgba(255, 237, 147, .8);
}
.summary-item.bonus-focus span { color: #405633; font-size: 16px; }
.summary-item.bonus-focus strong { color: #11331e; font-size: clamp(28px, 8vw, 40px); }
.summary-item.machine-bonus { background: #e9fff2; border-color: #b9eccb; }

.bonus-cta-wrap {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255,255,255,.16);
}
.bonus-cta {
  border: 0;
  min-height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8d75b, #fff4a3);
  color: #213b21;
  font-size: clamp(22px, 7vw, 32px);
  font-weight: 1000;
  letter-spacing: .02em;
  box-shadow: 0 14px 32px rgba(255, 219, 87, .22);
}
.bonus-cta-wrap small {
  color: rgba(255,255,255,.80);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.bottom-about { display: grid; gap: 10px; }
.about-toggle-btn {
  border: 0;
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  color: var(--green-900);
  box-shadow: var(--soft-shadow);
  border: 1px solid rgba(47, 125, 80, .14);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 900;
}
.about-toggle-btn b { font-size: 24px; line-height: 1; }
.about-panel { box-shadow: var(--soft-shadow); }

.bonus-modal-card h2 { padding-right: 42px; }
.unit-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.unit-input span {
  min-width: 92px;
  min-height: 54px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--green-75);
  border: 1px solid rgba(47, 125, 80, .20);
  color: var(--green-900);
  font-weight: 900;
}
.modal-actions-row .primary-btn,
.modal-actions-row .secondary-btn { flex: 1; }

@media (max-width: 420px) {
  .calculate-panel { bottom: 6px; border-radius: 20px; }
  .big-calculate-btn { min-height: 60px; }
  .bonus-cta { min-height: 56px; }
  .unit-input { grid-template-columns: 1fr; }
  .unit-input span { min-height: 42px; }
}

@media print {
  .calculate-panel, .bottom-about, .bonus-cta-wrap { display: none !important; }
}

/* Revisi v1.2 - bonus langsung masuk ke baris utama dan identitas aplikasi bisa diganti */
.brand-mark.has-image {
  overflow: hidden;
  background: rgba(255,255,255,.94);
}
.brand-mark.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 5px;
}
.summary-sub {
  display: block;
  width: 100%;
  margin-top: -2px;
  color: rgba(18, 53, 31, .72);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}
.summary-item.harvest .summary-sub {
  color: rgba(255,255,255,.75);
}
.settings-block {
  margin: 12px 0 16px;
  padding: 14px;
  border-radius: 20px;
  background: var(--green-75);
  border: 1px solid rgba(47, 125, 80, .16);
}
.settings-block h3 {
  margin-bottom: 8px;
  color: var(--green-900);
}
.setting-note {
  display: block;
  margin-top: 7px;
  color: #5f705f;
  font-weight: 700;
  line-height: 1.35;
}

@media (max-width: 420px) {
  .summary-sub { font-size: 12px; }
  .summary-item.highlight-pay strong { font-size: 38px; }
}

@media print {
  .summary-sub { color: #444 !important; }
}
