:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --border: #e6ded2;
  --text: #2b2420;
  --text-muted: #7a7066;
  --accent: #a3714c;
  --accent-dark: #7d5636;
  --green: #2f7a4d;
  --green-bg: #e7f5eb;
  --amber: #a37400;
  --amber-bg: #fbf1d9;
  --red: #b3402f;
  --red-bg: #fbeae7;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent-dark); }

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

.topbar .brand {
  font-weight: 700;
  font-size: 17px;
}

.topbar nav a {
  margin-left: 18px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
}

.topbar nav a.active { color: var(--accent-dark); }

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

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}
.flash.success { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .value { font-size: 20px; font-weight: 700; margin-top: 4px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.toolbar form { display: flex; gap: 8px; flex: 1; min-width: 220px; }

input[type="text"], input[type="tel"], input[type="number"], input[type="password"], select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.small { padding: 4px 10px; font-size: 12px; }

.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pills a {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
}
.filter-pills a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th { background: var(--bg); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }

.badge { padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge.done { background: var(--green-bg); color: var(--green); }
.badge.partial { background: var(--amber-bg); color: var(--amber); }
.badge.pledge { background: var(--red-bg); color: var(--red); }

.phone-missing { color: var(--red); font-size: 12.5px; }
.phone-inline-form { display: flex; gap: 6px; }
.phone-inline-form input { width: 130px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; }
.pagination a, .pagination span { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 13px; }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 560px; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-row input, .form-row textarea { width: 100%; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.checkbox-cell { width: 30px; }

.composer-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.composer-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-height: 560px; overflow-y: auto; }
.composer-list .row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.composer-list .row:last-child { border-bottom: none; }
.composer-list .name { flex: 1; }
.composer-side { position: sticky; top: 20px; }
.template-box textarea { width: 100%; min-height: 140px; }
.preview-box { background: var(--bg); border: 1px dashed var(--border); border-radius: 8px; padding: 10px; font-size: 13px; margin-top: 10px; white-space: pre-wrap; }
.muted { color: var(--text-muted); font-size: 12.5px; }
.result-section { margin-bottom: 22px; }
.result-section h3 { margin-bottom: 8px; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
