* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #1a5c38;
  --primary-light: #2d8a54;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555;
  --border: #ddd;
  --danger: #c0392b;
  --success: #27ae60;
  --warning: #f39c12;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 70px;
  padding-top: 60px;
  -webkit-tap-highlight-color: transparent;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 {
  font-size: 18px;
  font-weight: 700;
}

header #periode {
  font-size: 13px;
  opacity: 0.9;
}

main {
  padding: 12px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.card-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
}

.warga-item {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.15s;
  border-left: 4px solid var(--primary);
}

.warga-item:active {
  transform: scale(0.98);
}

.warga-item .name {
  font-size: 16px;
  font-weight: 600;
}

.warga-item .address {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.warga-item .amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--danger);
  margin-top: 4px;
}

.stats-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.stat-box {
  flex: 1;
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stat-box .value {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

.stat-box .label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.stat-box.danger .value {
  color: var(--danger);
}

.stat-box.success .value {
  color: var(--success);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th {
  background: var(--primary);
  color: white;
  padding: 8px 6px;
  text-align: left;
  font-weight: 600;
}

table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}

table tr:last-child td {
  border-bottom: none;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  min-width: 44px;
  min-height: 44px;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.8;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-success {
  background: var(--success);
  color: white;
  width: 100%;
}

.btn-danger {
  background: var(--danger);
  color: white;
  width: 100%;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  min-height: 44px;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 15px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header h2 {
  font-size: 18px;
  color: var(--primary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tagihan-table {
  margin: 10px 0;
}

.tagihan-table .total-row {
  font-weight: 700;
  background: #f0f4f8;
}

.total-bold {
  font-size: 18px;
  font-weight: 800;
  color: var(--danger);
  text-align: right;
  padding: 10px 0;
}

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 6px 12px;
  min-width: 60px;
  min-height: 44px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 22px;
}

.nav-label {
  font-size: 11px;
  margin-top: 2px;
  font-weight: 600;
}

#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#modal-overlay.hidden {
  display: none;
}

#modal-content {
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  animation: fadeIn 0.3s;
}

#toast.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.info-text {
  font-size: 13px;
  color: var(--text-secondary);
  background: #e8f5e9;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

@media (min-width: 768px) {
  main {
    max-width: 600px;
    margin: 0 auto;
  }
}
