* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Kanit", system-ui, sans-serif;
  background: #f4f7fb;
  color: #0f172a;
}

.app {
  max-width: 1280px;
  margin: auto;
  padding: 24px;
}

.page-header {
  background: linear-gradient(135deg, #0f2a45, #1457d9);
  color: white;
  padding: 28px;
  border-radius: 22px;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0 0 6px;
}

.page-header p {
  margin: 0;
  opacity: .85;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.card,
.panel {
  background: white;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  border: 1px solid #e5e7eb;
}

.card {
  padding: 20px;
}

.card span {
  display: block;
  color: #64748b;
  font-size: 14px;
}

.card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.card.danger strong {
  color: #dc2626;
}

.layout {
  display: grid;
  grid-template-columns: 1.6fr .9fr;
  gap: 18px;
}

.panel {
  padding: 20px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
}

th {
  color: #475569;
  background: #f8fafc;
}

.amount-red {
  color: #dc2626;
  font-weight: 700;
}

.amount-green {
  color: #16a34a;
  font-weight: 700;
}

form label {
  display: block;
  margin: 12px 0 6px;
  font-size: 13px;
  color: #475569;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2563eb;
}

button {
  border: 0;
  border-radius: 12px;
  background: #1457d9;
  color: white;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #0f46b3;
}

.btn-small {
  padding: 8px 10px;
  font-size: 12px;
  border-radius: 9px;
}

.btn-delete {
  background: #ef4444;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.transaction-form {
  display: grid;
  grid-template-columns: 1.1fr .8fr .7fr .8fr 1.2fr auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 900px) {
  .summary-grid,
  .layout,
  .transaction-form {
    grid-template-columns: 1fr;
  }
}



.installment-form {
  display: grid;
  grid-template-columns: 1.2fr .8fr .7fr .8fr .6fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.preview-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #075985;
  padding: 14px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

.badge-active {
  color: #15803d;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-closed {
  color: #475569;
  background: #e2e8f0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .installment-form {
    grid-template-columns: 1fr;
  }
}


.cashflow-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.alert-box {
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

.alert-safe {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.text-income {
  color: #16a34a;
  font-weight: 700;
}

.text-out {
  color: #dc2626;
  font-weight: 700;
}

.text-negative {
  color: #dc2626;
  font-weight: 800;
}

@media (max-width: 900px) {
  .cashflow-form {
    grid-template-columns: 1fr;
  }
}



.expense-form {
  display: grid;
  grid-template-columns: .8fr 1fr .8fr 1.2fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.badge-pending {
  color: #92400e;
  background: #fef3c7;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-approved {
  color: #166534;
  background: #dcfce7;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-rejected {
  color: #991b1b;
  background: #fee2e2;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.need-high {
  color: #166534;
  font-weight: 700;
}

.need-low {
  color: #dc2626;
  font-weight: 700;
}

.btn-approve {
  background: #16a34a;
}

.btn-reject {
  background: #ef4444;
}

.action-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .expense-form {
    grid-template-columns: 1fr;
  }
}


.debt-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.plan-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  font-weight: 600;
}

.risk-high {
  color: #dc2626;
  font-weight: 800;
}

.risk-medium {
  color: #d97706;
  font-weight: 800;
}

.risk-low {
  color: #16a34a;
  font-weight: 800;
}

@media (max-width: 900px) {
  .debt-plan-grid {
    grid-template-columns: 1fr;
  }
}

.simulator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.simulator-grid label {
  display: block;
  margin-bottom: 6px;
  color: #475569;
  font-size: 13px;
}

.sim-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  .simulator-grid,
  .sim-result-grid {
    grid-template-columns: 1fr;
  }
}



.btn-soft {
  background: #e0f2fe;
  color: #075985;
}

.btn-soft:hover {
  background: #bae6fd;
}