:root {
  --green: #00963c;
  --green-dark: #0a5228;
  --green-bright: #00ae42;
  --green-light: #e7f4ec;
  --ink: #2f3a33;
  --muted: #6b7a70;
  --line: #d9e2db;
  --bg: #f4f6f4;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Source Sans 3", system-ui, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 18px; }

/* Header */
.app-header {
  background: var(--green-dark);
  color: var(--white);
}
.app-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 78px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 60px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-parent {
  font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: #a9dcbb; font-weight: 600;
}
.brand-name { font-size: 1.25rem; font-weight: 700; color: var(--white); }
.brand-mark {
  background: var(--white);
  color: var(--green-dark);
  font-weight: 700;
  border-radius: 8px;
  padding: 3px 8px;
  letter-spacing: 0.5px;
}
.feedback { color: #cfe6d5; text-decoration: none; font-size: 0.95rem; }
.feedback:hover { color: var(--white); }

/* Tabs */
.tabs {
  background: var(--green);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 10px;
  position: sticky;
  top: 0;
  z-index: 500;
}
.tabs button {
  background: transparent;
  color: #dcefe1;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 14px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--white); }
.tabs button.active { color: var(--white); border-bottom-color: var(--white); }

/* View */
.view { max-width: 1000px; margin: 22px auto 40px; padding: 0 18px; }
.view h2 { color: var(--green-dark); margin: 0 0 4px; font-size: 1.5rem; }
.lead { color: var(--muted); margin: 0 0 18px; }

/* Roadmap */
.step {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.step h3 { margin: 0 0 4px; color: var(--green-dark); font-size: 1.1rem; }
.step .num {
  display: inline-block; background: var(--green-light); color: var(--green-dark);
  border-radius: 6px; padding: 1px 8px; margin-right: 8px; font-size: 0.9rem;
}
.step p { margin: 6px 0 10px; color: #3f4c44; }
.step a.reslink {
  display: inline-block; background: var(--green); color: var(--white);
  text-decoration: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 0.92rem;
}
.step a.reslink:hover { background: var(--green-dark); }

/* Resource buttons */
.folder-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.folder-btn {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--green-dark); font-weight: 600;
  box-shadow: var(--shadow); flex: 1 1 240px;
}
.folder-btn:hover { border-color: var(--green); }

/* Search + filters */
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.controls input, .controls select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--white); color: var(--ink);
}
.controls input { flex: 1 1 220px; }
.count { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.card h4 { margin: 0; color: var(--green-dark); font-size: 1.05rem; }
.card .city { color: var(--muted); font-size: 0.95rem; }
.card .meta { font-size: 0.9rem; color: #3f4c44; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.badge {
  font-size: 0.78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: var(--green-light); color: var(--green-dark);
}
.badge.area { background: #e7eef7; color: #274b74; }
.badge.staging { background: #f3ecdc; color: #7a5a1e; }
.badge.stage-searching { background: #e5eefb; color: #1f4f8f; }
.badge.stage-initial { background: #eee7f7; color: #5a3a86; }
.badge.stage-interim-needed { background: #fbe7e7; color: #8f2f2f; }
.badge.stage-interim-placed { background: #e3f2e6; color: #23663a; }
.badge.stage-monitoring, .badge.stage-monitor { background: #eef0f2; color: #4a5560; }

/* Resource list */
.res-list { display: flex; flex-direction: column; gap: 10px; }
.res-item {
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.res-item .rn { font-weight: 600; color: var(--green-dark); }
.res-item .rt { font-size: 0.82rem; color: var(--muted); margin-left: 6px; }
.res-item .rnote { font-size: 0.9rem; color: #3f4c44; margin-top: 3px; }
.res-item a { color: var(--green); font-weight: 600; text-decoration: none; }

/* Map */
#map { height: 62vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 0.88rem; color: #3f4c44; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.2); }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-size: 1.2rem; font-weight: 700; color: var(--green-dark); }
.cal-nav {
  background: var(--green-light); color: var(--green-dark); border: 0; border-radius: 8px;
  width: 40px; height: 40px; font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.cal-nav:hover { background: #d6ebdd; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-cell {
  min-height: 58px; background: var(--white); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; display: flex; flex-direction: column; justify-content: space-between;
}
.cal-cell.empty-cell { background: transparent; border: 0; }
.cal-cell.has-ev { cursor: pointer; border-color: var(--green); }
.cal-cell.has-ev:hover { background: var(--green-light); }
.cal-cell.today { outline: 2px solid var(--green-bright); }
.cal-daynum { font-size: 0.85rem; color: var(--ink); font-weight: 600; }
.cal-dots { display: flex; gap: 3px; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-list { display: flex; flex-direction: column; gap: 10px; }
.cal-item {
  background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer;
}
.cal-item:hover { border-color: var(--green); }
.cal-item .cd { font-weight: 700; color: var(--green-dark); }
.cal-item .ct { font-size: 0.85rem; color: var(--muted); }

@media (max-width: 560px) {
  .cal-cell { min-height: 46px; padding: 4px; }
  .cal-daynum { font-size: 0.78rem; }
}

/* Ask / chat */
.chat { display: flex; flex-direction: column; height: 66vh; min-height: 420px; }
.chat-log {
  flex: 1; overflow-y: auto; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.msg { margin-bottom: 12px; max-width: 85%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; }
.msg.user { background: var(--green); color: var(--white); margin-left: auto; border-bottom-right-radius: 4px; }
.msg.bot { background: var(--green-light); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.chat-form button {
  background: var(--green); color: var(--white); border: 0; border-radius: 12px;
  padding: 0 20px; font: inherit; font-weight: 600; cursor: pointer;
}
.chat-form button:disabled { opacity: 0.6; cursor: default; }
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; }

.empty { color: var(--muted); background: var(--white); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 26px; text-align: center; }

.app-footer { color: var(--muted); font-size: 0.85rem; padding: 20px 0 30px; text-align: center; }

/* Church detail modal */
.card { cursor: pointer; }
.card:hover { border-color: var(--green); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
.modal {
  background: var(--white); border-radius: var(--radius); max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 18px 18px 0; }
.modal-head h3 { margin: 0; color: var(--green-dark); font-size: 1.25rem; }
.modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 10px 18px 20px; }
#detail-map { height: 200px; border-radius: 10px; border: 1px solid var(--line); margin: 12px 0; }
.detail-row { margin: 8px 0; }
.detail-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.dir-wrap { display: block; margin-top: 6px; }
.dir-menu {
  margin-top: 10px; display: flex; flex-direction: column; gap: 10px;
}
.dir-choice {
  display: block; text-align: center; text-decoration: none;
  background: #fff; color: var(--green-dark); border: 2px solid var(--green);
  border-radius: 12px; padding: 14px 16px; font-size: 1.05rem; font-weight: 700;
}
.dir-choice:hover { background: var(--green-light); }
.dir-btn {
  width: 100%; background: var(--green); color: #fff; border: 0; border-radius: 12px;
  padding: 14px 16px; font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.dir-btn:hover { background: var(--green-dark); }

/* Interest form */
.interest-btn {
  width: 100%; background: var(--green-dark); color: #fff; border: 0; border-radius: 12px;
  padding: 14px 16px; font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer; margin-top: 10px;
}
.interest-btn:hover { background: #163a20; }
.iform label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 3px; }
.iform input, .iform textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.iform .req { color: #a23; }
.iform .submit {
  margin-top: 14px; background: var(--green); color: #fff; border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
}
.iform .submit:disabled { opacity: 0.6; cursor: default; }
.iform .err { color: #a23; font-size: 0.9rem; margin-top: 8px; }
.iform-done { padding: 10px 0; }
.iform-done h4 { color: var(--green-dark); margin: 0 0 6px; }

/* Home + login screen */
.home { max-width: 560px; margin: 22px auto; }
.home-intro h2 { color: var(--green-dark); margin: 0 0 6px; }
.home-form {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin: 18px 0;
}
.home-inside h3 { color: var(--green-dark); margin: 4px 0 12px; }
.tab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.tab-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow);
}
.tab-ico { color: var(--green); flex: 0 0 auto; margin-top: 2px; }
.tab-ico svg { width: 26px; height: 26px; display: block; }
.tab-card strong { display: block; color: var(--green-dark); margin-bottom: 3px; }
.tab-card .d { color: #3f4c44; font-size: 0.92rem; }

/* Dashboard table */
.dash-table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.92rem; }
.dash-table th, .dash-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dash-table th { background: var(--green-light); color: var(--green-dark); font-weight: 700; position: sticky; top: 0; }
.dash-table tr:hover td { background: #f6faf7; }

@media (max-width: 560px) {
  .brand-name { font-size: 1rem; }
  .cards { grid-template-columns: 1fr; }
}
