/* BCHBC Volunteer Hours — mobile-first styles.
 * Big touch targets (min 48px), high contrast, works on iPhone Safari. */

:root {
  --green: #2e5d34;
  --green-dark: #1f4225;
  --green-soft: #e7efe4;
  --paper: #faf8f1;
  --card: #ffffff;
  --ink: #22281f;
  --muted: #6b7263;
  --line: #dcd8c8;
  --danger: #a93226;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

/* ---------- header ---------- */
.app-header {
  background: var(--green);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.brand-mark { width: 46px; height: 46px; object-fit: contain; background: #fff; border-radius: 50%; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
.brand p { font-size: 12px; margin: 0; opacity: .85; }

.rolebar { display: flex; gap: 6px; }
.rolebtn {
  flex: 1;
  min-height: 44px;
  border: 2px solid rgba(255,255,255,.55);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.rolebtn.active { background: #fff; color: var(--green-dark); border-color: #fff; }

.chapterrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.chapterrow label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.chapterrow select {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: none;
  font-size: 16px;
  padding: 0 10px;
}

/* ---------- main ---------- */
main { padding: 16px 16px 8px; max-width: 720px; margin: 0 auto; }
.view h2 { margin: 4px 0 6px; font-size: 22px; }
.view h3 { margin: 22px 0 8px; font-size: 17px; border-bottom: 2px solid var(--green-soft); padding-bottom: 4px; }
.lede { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- form ---------- */
.field { margin-bottom: 16px; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline label { white-space: nowrap; margin: 0; }
.field.inline select { flex: 1; }
label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.req { color: var(--danger); }
.opt { font-weight: 400; color: var(--muted); font-size: 13px; }
.hint { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.err { font-size: 13px; color: var(--danger); margin: 4px 0 0; font-weight: 600; }

input[type="text"], input[type="date"], input[type="number"],
select, textarea {
  width: 100%;
  min-height: 48px;
  font-size: 17px; /* >=16px prevents iOS zoom-on-focus */
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 0; resize: vertical; }
input.invalid, select.invalid, textarea.invalid, .namelist.invalid input { border-color: var(--danger); background: #fdf0ef; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid #9cc3a5;
  outline-offset: 1px;
}

.namerow { display: flex; gap: 8px; margin-bottom: 8px; }
.namerow input { flex: 1; }
.iconbtn {
  min-width: 48px; min-height: 48px;
  border: 2px solid var(--line);
  background: #fff; border-radius: var(--radius);
  font-size: 22px; line-height: 1; color: var(--muted);
}

/* ---------- buttons ---------- */
.btn {
  min-height: 48px;
  padding: 10px 18px;
  font-size: 17px;
  font-weight: 700;
  border-radius: var(--radius);
  border: 2px solid var(--green);
  cursor: pointer;
  font-family: inherit;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.plain { background: #fff; color: var(--green-dark); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.big { width: 100%; margin-top: 6px; }
.btn.small { min-height: 40px; font-size: 14px; padding: 6px 12px; }

/* ---------- cards / lists ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.cardmeta { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 15px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions .btn { flex: 1; min-width: 100px; }
.rejectnote { color: var(--danger); font-size: 14px; font-weight: 600; }

.empty {
  text-align: center;
  padding: 32px 16px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 6px; }
.stat {
  background: var(--green-soft);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
}
.statnum { display: block; font-size: 24px; font-weight: 800; color: var(--green-dark); }
.statlabel { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th { background: var(--green-soft); font-size: 13px; }
.tbl tr.zerorow td { color: #b3b8aa; }
.tbl-wrap { overflow-x: auto; }

/* ---------- date row ---------- */
.daterow { display: flex; gap: 12px; }
.daterow .field { flex: 1; }

/* ---------- range presets ---------- */
.presets { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.presets .btn { flex: 1; min-width: 100px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.tab {
  flex: 1;
  border: none;
  background: none;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-family: inherit;
}
.tabicon { font-size: 22px; }
.tab.active { color: var(--green-dark); }
.badge {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  padding: 1px 6px;
  font-size: 12px;
  margin-left: 4px;
}

/* ---------- sync bar ---------- */
.syncbar {
  position: fixed;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-dark);
  color: #fff;
  font-size: 12.5px;
  padding: 8px 12px;
  z-index: 25;
}
.syncbar .btn { margin-left: auto; color: #fff; border-color: rgba(255,255,255,.6); }
.syncdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.syncdot.on { background: #7fd08a; }
.syncdot.off { background: #f0b429; }
.syncsep { opacity: .5; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
}
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal {
  background: #fff;
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .modal { border-radius: 16px; } }
.modal-head h2 { margin: 0 0 10px; font-size: 19px; }
.modal-foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal-foot .btn { flex: 1; min-width: 120px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(130px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  z-index: 60;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}

.errorbox {
  background: #fdf0ef;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---------- admins ---------- */
.warnbox {
  background: #fdf3e3;
  border: 2px solid #d9a441;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.pill.ok { background: #dff0e1; color: var(--green-dark); }
.pill.warn { background: #fdf3e3; color: #8a5a00; }
.pill.muted { background: #eee; color: var(--muted); }
.cardhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.adminrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

/* ---------- backend auth row ---------- */
.authrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 0;
}
.authwho {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
ol.steps { padding-left: 20px; }
ol.steps li { margin-bottom: 8px; }

/* ---------- volunteer blocks (one per volunteer on the entry form) ---------- */
.volblock {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.volhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.volhead span {
  font-weight: 800;
  font-size: 16px;
  color: var(--green-dark);
}
.volblock .field:last-child { margin-bottom: 2px; }

/* ---------- discreet admin sign-in (bottom of Chapter totals) ---------- */
.adminsignin {
  text-align: center;
  margin: 28px 0 10px;
  color: var(--muted);
  font-size: 14px;
}
.adminsignin .btn { margin-left: 6px; }

/* ---------- link-style buttons (drill-downs) ---------- */
.linkbtn {
  background: none;
  border: none;
  padding: 0;
  min-height: 44px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-dark);
  text-decoration: underline;
  text-align: left;
  cursor: pointer;
}

/* ---------- work-bee list rows ---------- */
.beelist { display: flex; flex-direction: column; gap: 8px; }
.beerow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-height: 56px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.beerow-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.beerow-main b { font-size: 15px; }
.beerow-proj {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.beerow-names {
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.beerow-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.beerow-chev { color: var(--muted); font-size: 22px; line-height: 1; }

/* ---------- bottom sheet (work-bee detail) ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  background: #fff;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px 20px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
}
.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: #d7d7d7;
  margin: 4px auto 10px;
}
.sheet .btn#beeSheetClose { width: 100%; margin-top: 14px; }
.sheetnotes {
  background: #f7f7f2;
  border-left: 3px solid var(--green);
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
}
