:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #71717a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand { font-weight: 600; font-size: 18px; color: var(--text); text-decoration: none; }

nav { display: flex; gap: 8px; align-items: center; }

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.icon-link:hover { background: var(--bg); color: var(--text); }

.inline-form { display: inline; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { background: #ecfdf5; color: #065f46; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 6px; }

.auth-card {
  max-width: 360px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-card h1 { font-size: 20px; margin-top: 0; }
.auth-card form p { margin: 10px 0; display: flex; flex-direction: column; gap: 4px; }
.auth-card input, .auth-card select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px;
}
.muted { color: var(--muted); font-size: 13px; }

.btn {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }

.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.search-icon { color: var(--muted); font-size: 20px; }
#search-input { border: none; outline: none; flex: 1; font-size: 14px; }

.toolbar-actions { display: flex; gap: 6px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.icon-btn.primary:hover { background: var(--accent-hover); }
.icon-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.advanced-panel {
  display: flex;
  gap: 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.advanced-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

.banner {
  background: #fff7ed;
  color: #9a3412;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 13px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sort-icon { font-size: 16px; vertical-align: middle; opacity: 0.5; }
th.sorted .sort-icon { opacity: 1; color: var(--accent); }

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

td[contenteditable="true"] { outline: 2px solid var(--accent); background: #eff6ff; }

.select-col { width: 32px; }

dialog {
  border: none;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90%;
}
dialog::backdrop { background: rgba(0,0,0,0.3); }
dialog h2 { margin-top: 0; font-size: 17px; }
dialog form label, dialog label {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 13px; color: var(--muted);
}
dialog input, dialog select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.type-badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.type-badge.donation { background: #ecfdf5; color: #065f46; }
.type-badge.income { background: #eff6ff; color: #1e40af; }
