* { box-sizing: border-box; }
body {
  font-family: "Tahoma", "Leelawadee UI", sans-serif;
  margin: 0;
  background: #f5f6f8;
  color: #1a1a1a;
}
nav {
  background: #1f2937;
  padding: 12px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
}
nav a {
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { color: #fff; }
nav .brand { font-weight: bold; color: #fff; margin-right: 12px; }
main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 22px; }
h2 { font-size: 18px; margin-top: 32px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}
th { background: #f0f1f3; }
tr:hover td { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.card {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
form.inline { display: inline; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}
.form-grid label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}
button {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { background: #1d4ed8; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button.secondary { background: #6b7280; }
button.secondary:hover { background: #4b5563; }
.flash {
  padding: 10px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.badge.cost { background: #fee2e2; color: #991b1b; }
.badge.income { background: #dbeafe; color: #1e40af; }
.badge.low { background: #fef3c7; color: #92400e; }
.actions { display: flex; gap: 8px; }
.chart-img { max-width: 100%; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* จุดสังเกต: แดง = รายจ่าย (cost), น้ำเงิน = รายรับ (income) */
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot.cost { background: #dc2626; }
.dot.income { background: #2563eb; }
td.type-dot { width: 20px; padding-right: 0; }
tr.cat-row.cost { border-left: 4px solid #dc2626; }
tr.cat-row.income { border-left: 4px solid #2563eb; }
tr.cat-row.cost td:first-child { border-left: 4px solid #dc2626; }
tr.cat-row.income td:first-child { border-left: 4px solid #2563eb; }
