:root {
  --green: #0b5d3b;
  --green-dark: #08482e;
  --green-light: #e6f4ec;
  --ink: #1a1a1a;
  --muted: #666;
  --border: #ddd;
  --bg: #f6f6f4;
  --card: #fff;
  --red: #b3261e;
  --red-bg: #fdecea;
  --ok: #0b5d3b;
  --ok-bg: #e6f4ec;
  --amber: #8a6d00;
  --amber-bg: #fff4cc;
  --grey-bg: #eee;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 960px; margin: 0 auto; padding: 0 16px 48px; }
.view.hidden, .hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
h1 { font-size: 1.4rem; margin: 18px 0 4px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.nav-panel h2:first-child { margin-top: 16px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 0 8px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--green); color: #fff; font-weight: 800;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.test-banner {
  background: #fff4cc; color: #5c4700; border: 1px solid #e8d27a;
  border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; font-weight: 600;
  text-align: center; margin: 4px 0 12px;
}
.error {
  background: var(--red-bg); color: var(--red);
  border-radius: 8px; padding: 9px 10px; font-size: 0.9rem; margin: 10px 0;
}
.ok {
  background: var(--ok-bg); color: var(--ok);
  border-radius: 8px; padding: 9px 10px; font-size: 0.9rem; margin: 10px 0;
}

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin: 12px 0;
}
.auth-card { max-width: 440px; }
label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 10px; }
input, select {
  display: block; width: 100%; margin-top: 4px; padding: 11px 10px;
  font-size: 1rem; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 1px; }

.btn {
  display: inline-block; padding: 12px 18px; border: none; border-radius: 10px;
  font-size: 1rem; font-weight: 700; cursor: pointer; background: var(--green); color: #fff;
}
.btn:active { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--green); padding: 8px 10px; }
.btn-small { padding: 7px 12px; font-size: 0.85rem; }
.btn-secondary { background: #eee; color: var(--ink); }
form .btn-primary { width: 100%; margin-top: 4px; }

.badge {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 0.75rem; text-align: center;
}

/* Top navigation (admin sections) */
.topnav {
  display: flex; gap: 6px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; margin: 4px 0 8px;
}
.nav-btn {
  flex: 1; min-width: 100px; padding: 10px 8px; border: none; background: transparent;
  font-size: 0.95rem; font-weight: 700; cursor: pointer; color: var(--muted);
  border-radius: 8px;
}
.nav-btn.active { background: var(--green); color: #fff; }
.nav-btn .badge { margin-left: 2px; }

/* Dashboard stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card { margin: 0; text-align: left; }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.stat-value { font-size: 2rem; font-weight: 800; margin: 2px 0; }
.stat-sub { margin-top: 2px; }

/* Filters */
.filters { display: flex; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.filter-btn {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; font-size: 0.9rem; font-weight: 600; cursor: pointer; color: var(--ink);
}
.filter-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; margin-bottom: 8px;
}
.list .row-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.list .row-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 700;
  background: var(--green-light); color: var(--green);
}
.pill.pending { background: var(--amber-bg); color: var(--amber); }
.pill.declined, .pill.failed { background: var(--red-bg); color: var(--red); }
.pill.grey { background: var(--grey-bg); color: var(--muted); }
.contact-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Inline settle form on each unsettled transaction row */
.settle-form {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center;
}
.settle-form select { width: auto; min-width: 150px; margin-top: 0; padding: 8px 10px; }
.settle-form input { flex: 1; min-width: 160px; margin-top: 0; padding: 8px 10px; }

.footer { text-align: center; margin-top: 24px; }
@media (min-width: 520px) {
  #app { padding-top: 10px; }
}
