.form-card {
  display: grid;
  gap: 16px;
  margin: 0 0 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-card h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.form-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

/* Kartu "Tambah Massal": dibedakan dengan permukaan netral yang lembut. */
.form-card--bulk {
  border-color: var(--line);
  background: var(--surface-soft);
}

.form-card--bulk h2 {
  color: var(--ink-strong);
}

.form-card--bulk > p {
  color: var(--muted);
}

.bulk-hint {
  color: var(--green);
  font-weight: 600;
}

.field {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin: 0;
  color: var(--ink);
}

.field > span,
.field legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  background: var(--surface);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--faint);
  opacity: 1;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.fieldset legend {
  margin-bottom: 8px;
  padding: 0;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-option {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.check-option input {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--green);
}

.check-option span {
  overflow-wrap: anywhere;
}

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

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  transition: filter 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button--primary {
  flex: 1 1 160px;
  background: var(--green);
  color: #fff;
}

.button--primary:hover {
  filter: brightness(1.08);
}

.button--quiet {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button--quiet:hover {
  background: var(--surface-soft);
}

.button--brown {
  flex: 1 1 160px;
  background: var(--green-deep);
  color: #fff;
}

.button--brown:hover {
  filter: brightness(1.1);
}

.button--danger {
  border: 1px solid #f2d6d2;
  background: var(--red-soft);
  color: var(--red);
}

.button[hidden] {
  display: none;
}

.calculation-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #dcebe1;
  border-radius: var(--radius-sm);
  background: var(--green-tint);
}

.calculation-card > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.calculation-card b {
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
  text-align: right;
}

.calculation-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.list-section {
  padding-bottom: 8px;
}

.list-section > .section-title {
  margin: 0 0 16px;
}

.record-list {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  min-width: 0;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.record-main {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.record-title-row {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.record-title-row h3 {
  min-width: 0;
  margin: 0;
  color: var(--ink-strong);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.record-meta,
.record-detail {
  margin: 0;
  color: var(--label);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.record-detail {
  color: var(--muted);
}

.record-detail b {
  color: var(--ink);
}

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

.record-actions .button {
  flex: 1 1 90px;
}

.amount-pill,
.status-pill {
  display: inline-flex;
  min-height: 32px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.amount-pill {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill {
  max-width: 52%;
  white-space: normal;
}

.status-pill--off {
  background: var(--surface-soft);
  color: var(--label);
}

/* --- Tag status bon / pengambilan ----------------------------------------- */
.form-card > .field-hint {
  margin: -6px 0 0;
  color: var(--label);
  font-size: 13px;
  line-height: 1.45;
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--label);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
}

.status-tag--lunas {
  background: var(--green-soft);
  color: var(--green);
}

.status-tag--bon {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-tag--belum {
  background: var(--surface-soft);
  color: var(--label);
}

.status-tag--diambil {
  background: #e8f1fb;
  color: #1d4ed8;
}

.record-debt {
  margin: 0;
  color: var(--amber);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.record-debt b {
  color: var(--amber);
}

.record-payment-meta {
  margin: 0;
  color: var(--label);
  font-size: 12px;
  line-height: 1.4;
}

.text-amber {
  color: var(--amber);
}

.button--accent {
  flex: 1 1 120px;
  border: 1px solid #f0d9b5;
  background: var(--amber-soft);
  color: var(--amber);
}

.button--accent:hover {
  filter: brightness(0.98);
}

#penjualan-status[data-status="Lunas"] {
  color: var(--green);
}

#penjualan-status[data-status="Bon"] {
  color: var(--amber);
}

#penjualan-status[data-status="Lewat"] {
  color: var(--red);
}

/* --- Modal (sheet dari bawah di layar HP) --------------------------------- */
.modal-backdrop {
  position: absolute;
  z-index: 70;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow-y: auto;
  background: rgb(15 23 42 / 48%);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.modal-backdrop[hidden] {
  display: none;
}

/* Kunci scroll halaman di belakang modal. */
body.modal-open .view.active .scroll {
  overflow-y: hidden;
}

.modal-card {
  width: 100%;
  max-height: 92%;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  animation: modal-sheet-in 180ms ease;
}

@keyframes modal-sheet-in {
  from {
    opacity: 0.6;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.modal-sub {
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.modal-summary {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #dcebe1;
  border-radius: var(--radius-sm);
  background: var(--green-tint);
}

.modal-summary > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.modal-summary b {
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  text-align: right;
}

.modal-summary > div:last-child b {
  color: var(--amber);
}

.modal-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.payment-history {
  margin-top: 20px;
}

.payment-history h3 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 700;
}

.payment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.payment-item:last-child {
  border-bottom: 0;
}

.payment-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.payment-copy b {
  color: var(--ink);
  font-size: 15px;
}

.payment-copy span {
  color: var(--label);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.payment-remove {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
}

@media (min-width: 480px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }

  .modal-card {
    border-radius: var(--radius-lg);
  }
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--muted);
  text-align: center;
}

.empty-state > span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--label);
}

.empty-state .icon,
.empty-state svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.empty-state b {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.notice-card {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
}

.notice-card b {
  color: var(--ink);
  font-size: 15px;
}

.notice-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.hub-menu-title {
  margin: 8px 0 16px;
}

.hub-grid {
  display: grid;
  gap: 12px;
}

.hub-card {
  display: grid;
  min-width: 0;
  min-height: 84px;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.hub-card:active {
  transform: scale(0.98);
  box-shadow: none;
}

.hub-card .menu-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-radius: var(--radius-sm);
}

.hub-card .menu-icon svg,
.hub-card .menu-icon .icon {
  width: 24px;
  height: 24px;
}

.menu-detail {
  display: block;
  margin-top: 2px;
  color: var(--label);
  font-size: 13px;
  line-height: 1.4;
}

.menu-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--faint);
}

.menu-arrow svg,
.menu-arrow .icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.hub-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 24px;
}

.hub-stat {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 6px;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hub-stat b {
  color: var(--ink-strong);
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.hub-stat span {
  color: var(--label);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hub-stats--money {
  grid-template-columns: minmax(0, 1fr);
}

.hub-stats--money .hub-stat {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 16px;
}

.hub-stats--money .hub-stat b {
  text-align: right;
  color: var(--green);
  font-size: clamp(18px, 5.5vw, 24px);
}

.rekap-section {
  margin-bottom: 24px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.history-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}

.history-table th,
.history-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
  vertical-align: top;
}

.history-table th {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-table td[colspan] {
  padding: 16px;
}

.history-table td[colspan] .empty-state {
  min-width: 260px;
}

.settings-list {
  display: grid;
  gap: 12px;
  margin: 8px 0 24px;
}

.settings-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--green);
}

.settings-icon svg,
.settings-icon .icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.settings-card h2 {
  margin: 0 0 4px;
  color: var(--ink-strong);
  font-size: 16px;
  font-weight: 700;
}

.settings-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.settings-refresh {
  width: 100%;
  margin-bottom: 24px;
}

@media (max-width: 360px) {
  .field-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .check-grid {
    grid-template-columns: 1fr;
  }

  .hub-card {
    gap: 12px;
    padding: 14px 12px;
  }
}
