/* Pastor portal — Montserrat, mobile-first, readable for older adults */
:root {
  --pp-bg0: #eef2ff;
  --pp-bg1: #e0e7ff;
  --pp-card: #ffffff;
  --pp-text: #0f172a;
  /* Darker muted for WCAG-friendly contrast on small screens */
  --pp-muted: #475569;
  --pp-border: rgba(15, 23, 42, 0.1);
  --pp-accent: #2563eb;
  --pp-accent-mid: #1d4ed8;
  --pp-accent-deep: #1e40af;
  --pp-danger-bg: #fef2f2;
  --pp-danger-text: #991b1b;
  --pp-success-bg: #eff6ff;
  --pp-success-text: #1e40af;
  --pp-radius: 16px;
  --pp-shadow: 0 4px 14px rgba(15, 23, 42, 0.07), 0 2px 4px rgba(15, 23, 42, 0.04);
  --pp-font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pp-text-lg: clamp(1.0625rem, 0.5vw + 1rem, 1.125rem);
  --pp-line: 1.55;
  --pp-touch: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.pastor-portal {
  margin: 0;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  font-family: var(--pp-font);
  font-size: var(--pp-text-lg);
  line-height: var(--pp-line);
  color: var(--pp-text);
  background: var(--pp-bg0);
  background-image:
    radial-gradient(ellipse 120% 70% at 50% -15%, rgba(37, 99, 235, 0.12), transparent 55%),
    linear-gradient(180deg, var(--pp-bg0) 0%, var(--pp-bg1) 100%);
  -webkit-font-smoothing: antialiased;
  /* Extra bottom space on phones so sticky save never covers last field */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.pastor-portal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 14px clamp(16px, 4vw, 22px);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--pp-border);
}

.pastor-portal__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--pp-text);
  font-weight: 600;
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  letter-spacing: -0.02em;
}

.pastor-portal__brand:hover {
  color: var(--pp-accent);
}

.pastor-portal__brand small {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--pp-muted);
  letter-spacing: 0.02em;
}

.pastor-portal__badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-accent);
  padding: 8px 14px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.22);
}

.pastor-portal__main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px) clamp(14px, 4vw, 22px) calc(28px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 640px) {
  .pastor-portal__main:not(.pastor-portal__main--login) {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
}

.pastor-portal__main--login {
  max-width: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 12px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.pastor-portal__footer {
  flex-shrink: 0;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.88rem;
  color: var(--pp-muted);
  border-top: 1px solid var(--pp-border);
  background: rgba(255, 255, 255, 0.65);
}

.pastor-portal__footer a {
  color: var(--pp-accent);
  text-decoration: none;
  font-weight: 600;
}

.pastor-portal__footer a:hover {
  text-decoration: underline;
}

.pastor-portal__login {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 8px 0;
}

.pastor-card {
  width: 100%;
  max-width: 440px;
  background: var(--pp-card);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  border: 1px solid rgba(255, 255, 255, 0.95);
  padding: clamp(24px, 5vw, 36px) clamp(20px, 5vw, 32px);
}

.pastor-card--wide {
  max-width: 720px;
}

.pastor-card__title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.pastor-card__sub {
  margin: 0 0 24px;
  font-size: 0.95rem;
  color: var(--pp-muted);
  line-height: var(--pp-line);
}

.pastor-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pp-muted);
  margin-bottom: 8px;
}

.pastor-input {
  width: 100%;
  min-height: var(--pp-touch);
  padding: 12px 16px;
  font-family: var(--pp-font);
  font-size: 1rem;
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.pastor-input:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.pastor-input-wrap {
  position: relative;
  display: block;
}

.pastor-input--has-toggle {
  padding-right: 52px;
}

.pastor-input-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--pp-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.pastor-input-toggle:hover {
  color: var(--pp-accent);
  background: rgba(37, 99, 235, 0.08);
}

.pastor-input-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
}

.pastor-eye[hidden] {
  display: none !important;
}

.pastor-field {
  margin-bottom: 20px;
}

.pastor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--pp-touch);
  padding: 14px 20px;
  font-family: var(--pp-font);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: linear-gradient(165deg, #3b82f6 0%, var(--pp-accent-mid) 50%, var(--pp-accent-deep) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.pastor-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
}

.pastor-btn:active {
  transform: translateY(0);
}

.pastor-btn--ghost {
  width: auto;
  min-height: 44px;
  background: transparent;
  color: var(--pp-muted);
  border: 2px solid var(--pp-border);
  box-shadow: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 16px;
}

.pastor-btn--ghost:hover {
  color: var(--pp-accent);
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(37, 99, 235, 0.06);
  transform: none;
  box-shadow: none;
}

.pastor-btn--soft {
  background: rgba(37, 99, 235, 0.12);
  color: var(--pp-accent-deep);
  border: 2px solid rgba(37, 99, 235, 0.28);
  box-shadow: none;
}

.pastor-btn--soft:hover {
  background: rgba(37, 99, 235, 0.18);
  box-shadow: none;
  transform: none;
}

.pastor-btn--success {
  background: linear-gradient(165deg, #60a5fa 0%, #3b82f6 52%, #1d4ed8 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.pastor-btn--success:hover {
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.38);
}

.pastor-btn--ghost-strong {
  background: #fff;
  color: #0f172a;
  border: 2px solid rgba(15, 23, 42, 0.2);
  box-shadow: none;
}

.pastor-btn--ghost-strong:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.35);
  box-shadow: none;
  transform: none;
}

.pastor-alert {
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 0.98rem;
  line-height: var(--pp-line);
  margin-bottom: 20px;
}

.pastor-alert--err {
  background: var(--pp-danger-bg);
  color: var(--pp-danger-text);
  border: 1px solid rgba(153, 27, 27, 0.18);
}

.pastor-alert--ok {
  background: var(--pp-success-bg);
  color: var(--pp-success-text);
  border: 1px solid rgba(37, 99, 235, 0.22);
}

/* Toolbar */
.pastor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.pastor-toolbar__user strong {
  display: block;
  font-size: clamp(1.08rem, 2.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.3;
}

.pastor-toolbar__user span {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--pp-muted);
}

/* Panels */
.pastor-panel {
  background: var(--pp-card);
  border-radius: var(--pp-radius);
  box-shadow: var(--pp-shadow);
  border: 1px solid rgba(255, 255, 255, 0.9);
  padding: clamp(18px, 4vw, 24px) clamp(16px, 4vw, 22px);
  margin-bottom: clamp(14px, 3vw, 18px);
}

.pastor-panel__title {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-muted);
}

/* Period row (month + load) */
.pastor-period-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
}

.pastor-period-row .pastor-field {
  flex: 1 1 200px;
  margin-bottom: 0;
}

.pastor-period-row .pastor-field--month {
  min-width: min(100%, 220px);
}

.pastor-period-row__action {
  flex: 0 0 auto;
  padding-bottom: 2px;
}

.pastor-textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  font-family: var(--pp-font);
  font-size: 1rem;
  line-height: var(--pp-line);
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #f8fafc;
  resize: vertical;
}

.pastor-textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.pastor-q-label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
  font-size: clamp(1rem, 2.5vw, 1.08rem);
  line-height: 1.4;
  color: var(--pp-text);
}

/* Local checkboxes — one column on narrow phones for easy tapping */
.pastor-local-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

@media (min-width: 420px) {
  .pastor-local-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

.pastor-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--pp-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
  touch-action: manipulation;
}

.pastor-check:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
}

.pastor-check input {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--pp-accent);
}

.pastor-muted {
  margin: 0;
  color: var(--pp-muted);
  font-size: 0.98rem;
  line-height: var(--pp-line);
}

.pastor-history-help {
  margin-top: -2px;
}

.pastor-history-list {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.pastor-history-item {
  border: 2px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
}

.pastor-history-item__head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.pastor-history-item__head strong {
  font-size: 1.08rem;
  color: var(--pp-text);
}

.pastor-history-item__head span {
  font-size: 0.9rem;
  color: var(--pp-muted);
}

.pastor-history-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.pastor-download-form {
  margin: 0;
}

.pastor-download-form .pastor-btn {
  width: 100%;
}

@media (min-width: 640px) {
  .pastor-history-actions {
    grid-template-columns: minmax(0, 240px);
  }
}

.pastor-view-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.pastor-view-actions > a,
.pastor-view-actions > form {
  min-width: 0;
}

.pastor-view-actions .pastor-btn {
  width: 100%;
  white-space: nowrap;
}

.pastor-answer-item {
  padding: 12px 0;
  border-bottom: 1px dashed rgba(15, 23, 42, 0.14);
}

.pastor-answer-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pastor-answer-box {
  border: 2px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
  white-space: normal;
  word-break: break-word;
}

.pastor-answer-box--empty {
  color: var(--pp-muted);
  font-style: italic;
}

.pastor-answer-list {
  margin: 0;
  padding-left: 20px;
}

.pastor-answer-list li {
  margin: 4px 0;
}

@media (min-width: 380px) and (max-width: 767px) {
  .pastor-view-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pastor-view-actions > :first-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) {
  .pastor-view-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pastor-view-actions > :first-child {
    grid-column: auto;
  }
}

.pastor-btn--inline {
  width: auto;
  min-height: var(--pp-touch);
  padding: 12px 22px;
  font-size: 1rem;
}

/* Sticky save — stays visible at bottom on phone while scrolling long forms */
.pastor-save-wrap {
  margin-top: 8px;
}

.pastor-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 20px;
  margin-left: clamp(-14px, -4vw, -22px);
  margin-right: clamp(-14px, -4vw, -22px);
  padding: 14px clamp(14px, 4vw, 22px) calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(248, 250, 252, 0.98) 60%, rgba(248, 250, 252, 0));
  border-top: 1px solid var(--pp-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pastor-save-bar .pastor-btn {
  width: 100%;
  min-height: 54px;
  font-size: 1.08rem;
  border-radius: 14px;
}

@media (min-width: 641px) {
  .pastor-save-bar {
    position: static;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    background: none;
    border: none;
    backdrop-filter: none;
  }

  .pastor-save-bar .pastor-btn {
    width: auto;
    min-height: var(--pp-touch);
  }
}

@media (max-width: 520px) {
  .pastor-portal__header {
    padding: 12px 14px;
  }

  .pastor-card {
    padding: 22px 18px;
  }
}
