:root {
  --bg-1: #fff8f0;
  --bg-2: #fefcf8;
  --text: #2e2117;
  --muted: #7a6555;
  --card: rgba(255, 255, 255, 0.85);
  --stroke: #ecdccb;
  --primary: #d97706;
  --primary-dark: #9a4f02;
  --income: #15803d;
  --income-soft: #e8f8ef;
  --expense: #b91c1c;
  --expense-soft: #fdeeee;
  --shadow: 0 18px 55px rgba(130, 92, 51, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, #ffe6c8 0, transparent 38%),
    radial-gradient(circle at 85% 85%, #ffe4d2 0, transparent 36%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  padding: 28px 16px 60px;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 100%;
  z-index: -1;
  filter: blur(14px);
}

.bg-shape-1 {
  width: 260px;
  height: 260px;
  top: -90px;
  right: -40px;
  background: rgba(217, 119, 6, 0.18);
}

.bg-shape-2 {
  width: 300px;
  height: 300px;
  bottom: -120px;
  left: -80px;
  background: rgba(190, 24, 93, 0.08);
}

.container {
  width: min(1060px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
  animation: rise-in 450ms ease-out both;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3.2vw, 2.4rem);
  letter-spacing: -0.02em;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(7px);
  padding: 18px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.card label {
  display: block;
  font-size: 0.93rem;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid rgba(217, 119, 6, 0.24);
  border-color: rgba(217, 119, 6, 0.45);
}

.inline-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.card-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.status-pill {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid transparent;
}

.status-idle {
  color: #73510f;
  background: #fff2d7;
  border-color: #f8d28d;
}

.status-ok {
  color: #136232;
  background: #e7f7ee;
  border-color: #a7e4bd;
}

.status-fail {
  color: #8e1c1c;
  background: #fee5e5;
  border-color: #f8b2b2;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

.btn-primary {
  background: linear-gradient(130deg, var(--primary), #f59e0b);
  color: #fff;
}

.btn-secondary {
  background: #f2e6d8;
  color: #5d3d20;
}

.btn-danger {
  background: #fff;
  color: #9f1d1d;
  border: 1px solid #f0b5b5;
}

.summary-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-box {
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 12px;
  background: #fff;
}

.summary-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-box strong {
  display: block;
  margin-top: 3px;
  font-size: 1.04rem;
}

.summary-box.income strong {
  color: var(--income);
}

.summary-box.expense strong {
  color: var(--expense);
}

.summary-box.balance strong {
  color: var(--primary-dark);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #f0e2d6;
}

th {
  font-size: 0.88rem;
  color: #6d5645;
  background: #fff9f1;
}

tbody tr {
  animation: row-in 250ms ease both;
}

tr.pemasukan td {
  background: var(--income-soft);
}

tr.pengeluaran td {
  background: var(--expense-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 8px;
}

.badge.income {
  background: #c9f0d8;
  color: #0f5e2e;
}

.badge.expense {
  background: #ffd4d4;
  color: #8b1f1f;
}

.nominal {
  font-weight: 700;
}

.nominal.income {
  color: var(--income);
}

.nominal.expense {
  color: var(--expense);
}

.empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

@keyframes rise-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes row-in {
  from {
    transform: translateY(5px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 780px) {
  .form-grid,
  .summary-wrap {
    grid-template-columns: 1fr;
  }

  .inline-input {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 10px;
    font-size: 0.93rem;
  }
}
