/* ألوان مأخوذة من شعار الجمعية: أخضر الشجرة، وألوان الأشخاص */
:root {
  --green: #2e7d4f;
  --green-dark: #205c39;
  --green-light: #e8f3ec;
  --red: #c0483b;
  --blue: #3a6ea5;
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #26302a;
  --muted: #6d776f;
  --line: #dde3dd;
  --danger: #b3362a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
.hidden { display: none !important; }

/* ---------- الدخول ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--green-light), var(--bg));
  padding: 16px;
}
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 22px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 4px 18px rgba(46,125,79,.10);
}
.auth-logo { width: 90px; margin-bottom: 8px; }
.auth-card h1 { font-size: 20px; margin: 0 0 18px; color: var(--green-dark); }
.auth-card label { display: block; text-align: right; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.auth-card input, .auth-card select {
  width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; background: #fff;
}
.switch-link { font-size: 14px; margin-top: 14px; }
.switch-link a { color: var(--green); }
.note { font-size: 13px; color: var(--muted); background: var(--green-light); padding: 8px; border-radius: 8px; margin-top: 12px; }
#authMsg { margin-top: 12px; font-size: 14px; }
#authMsg.err { color: var(--danger); }
#authMsg.ok { color: var(--green); }

/* ---------- الهيكل ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-bottom: 2px solid var(--green);
  padding: 8px 14px; position: sticky; top: 0; z-index: 20;
}
.topbar-logo { width: 42px; height: 42px; object-fit: contain; }
.topbar-title { display: flex; flex-direction: column; line-height: 1.25; flex: 1; }
.topbar-title strong { color: var(--green-dark); font-size: 16px; }
.topbar-title span { font-size: 12.5px; color: var(--muted); }
.net { font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.net.ok { background: var(--green-light); color: var(--green-dark); }
.net.off { background: #fdeceb; color: var(--danger); }

main { padding: 14px 14px 84px; max-width: 760px; margin: 0 auto; }

.bottomnav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 20;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
}
.bottomnav a {
  flex: 1; text-align: center; padding: 12px 4px 14px; font-size: 13.5px;
  color: var(--muted); text-decoration: none; border-top: 3px solid transparent;
}
.bottomnav a.active { color: var(--green-dark); border-top-color: var(--green); font-weight: 600; }

/* ---------- مكونات ---------- */
h2.page-title { font-size: 19px; margin: 4px 0 14px; color: var(--green-dark); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--green-dark); }
.callout {
  background: var(--green-light); border: 1px solid #cfe2d5; border-radius: 9px;
  padding: 10px 12px; margin: 10px 0; color: var(--green-dark); line-height: 1.6;
}

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat .num { font-size: 26px; font-weight: 700; color: var(--green-dark); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat.male .num { color: var(--blue); }
.stat.female .num { color: var(--red); }
.stat.late .num { color: var(--danger); }

.btn {
  display: inline-block; border: none; border-radius: 9px; padding: 10px 16px;
  font-size: 15px; cursor: pointer; background: #e9ede9; color: var(--text);
  font-family: inherit; text-decoration: none;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 11px; font-size: 13.5px; border-radius: 7px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn:active { opacity: .85; }

.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; padding: 11px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }

.list-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.list-item .grow { flex: 1; }
.list-item .name { font-weight: 600; }
.list-item .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.code-badge { background: var(--green-light); color: var(--green-dark); font-size: 12.5px; padding: 3px 8px; border-radius: 6px; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 20px; }
.badge.ok { background: var(--green-light); color: var(--green-dark); }
.badge.late { background: #fdeceb; color: var(--danger); }
.badge.stopped { background: #eee; color: var(--muted); }
.badge.male { background: #e8eef7; color: var(--blue); }
.badge.female { background: #f9e9e7; color: var(--red); }

form.entry label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
form.entry input, form.entry select, form.entry textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 15px; background: #fff; font-family: inherit;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.simple th { color: var(--muted); font-weight: 600; font-size: 13px; }

.receipt-photo { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 600; }

.toast {
  position: fixed; bottom: 78px; right: 50%; transform: translateX(50%);
  background: var(--green-dark); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14.5px; z-index: 50; max-width: 90%; text-align: center;
}
.toast.err { background: var(--danger); }

.back { color: var(--green); text-decoration: none; font-size: 14.5px; display: inline-block; margin-bottom: 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13.5px; }
.total-line { font-size: 17px; font-weight: 700; color: var(--green-dark); }

.check-line { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check-line input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); }
.check-line input[type=number] { width: 100px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; }
.check-line .grow { flex: 1; }

@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }

/* ===== Filter Panel ===== */
.filter-panel {
  background: var(--card-bg, #f9f9f9);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.filter-row > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 130px;
  flex: 1;
}
.filter-row label {
  font-size: 0.75rem;
  color: var(--muted, #888);
  font-weight: 600;
}
.filter-row input,
.filter-row select {
  padding: 5px 8px;
  border: 1px solid var(--border, #ddd);
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
}
.filter-badge {
  background: var(--green, #2d8653);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.7rem;
  margin-right: 2px;
}
.btn.active {
  background: var(--green-light, #e8f5ee);
  border-color: var(--green, #2d8653);
  color: var(--green-dark, #1a5c38);
}
