/* =====================================================================
   Panel Member Application Applet — theme
   Carried across from the Advance Information / Expenses applets so the
   suite looks identical: Open Sans for UI, Shadows Into Light Two for the
   brand wordmark, the #1B9413 / #4D8D3F green system on warm off-white,
   12px cards, 8px inputs/buttons, 44px touch targets.
   ===================================================================== */

:root {
  --primary: #1B9413;
  --primary-dark: #157A0F;
  --secondary: #4D8D3F;
  --bg: #F5F5F3;
  --card: #FFFFFF;
  --text: #2C2A26;
  --text-secondary: #4A4A4A;
  --border: #E0E0E0;
  --error: #D32F2F;
  --warning: #F57C00;
  --info: #1976D2;
  --success: #388E3C;
  --shadow: rgba(0, 0, 0, 0.08);
  --panel: #F7F7F5;
  --radius-card: 12px;
  --radius-control: 8px;
  --maxw: 600px;
  --font: "Open Sans", Arial, sans-serif;
  --font-brand: "Shadows Into Light Two", "Open Sans", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 18px calc(56px + env(safe-area-inset-bottom));
}

/* --- Masthead ----------------------------------------------------------- */
.masthead { text-align: center; padding: 6px 0 22px; }
/* The logo + wordmark link back to the main website. Keep it visually
   identical to the non-linked masthead: no underline, inherited colours. */
.masthead-link { display: inline-block; text-decoration: none; color: inherit; cursor: pointer; }
.masthead-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px; }
.masthead img.logo { width: 96px; height: auto; display: inline-block; border-radius: 12px; }
.masthead .wordmark {
  margin: 6px 0 0;
  font-family: var(--font-brand);
  font-size: 30px;
  line-height: 1.1;
  color: var(--secondary);
  font-weight: 400;
}
.masthead .wordmark .tm { font-family: var(--font); font-size: 0.35em; vertical-align: super; }

/* --- Headings ----------------------------------------------------------- */
h1.page-title {
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 700;
  margin: 14px 0 2px;
  text-align: center;
}
.subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 22px;
}

/* --- Cards -------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin: 0 0 12px;
  box-shadow: 0 1px 4px var(--shadow);
}
.card h2 {
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 12px;
  font-weight: 700;
}
.card h2 .optional-tag {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* --- Form --------------------------------------------------------------- */
label.field-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 6px;
}
.req { color: var(--primary); font-weight: 700; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  min-height: 44px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
}
input.invalid, select.invalid { border-color: var(--error); }
.field { margin: 0 0 16px; }
.hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 6px; }

/* Paired fields on one row (collapses on mobile) */
.row2 { display: flex; gap: 12px; }
.row2 > .field { flex: 1; }
@media (max-width: 480px) { .row2 { flex-direction: column; gap: 0; } }

/* Checkbox rows and consent wording */
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; }
.check-row input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
/* Chair-app palette rule: form controls take the primary green (#1B9413) —
   without accent-color, iOS/Safari renders checkboxes and radios blue. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.check-row label { font-size: 0.9rem; color: var(--text); }
.consent-intro { font-size: 0.9rem; color: var(--text); margin: 0 0 4px; }
.privacy-note { font-size: 0.8rem; color: var(--text-secondary); margin: 14px 0 0; }
.privacy-note a { color: var(--secondary); }

/* Honeypot: moved off-canvas rather than display:none so naive bots still
   fill it in; invisible and non-interactive for everyone else. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* Note under the subscribe button */
.confirm-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 10px 0 0;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px 24px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--primary);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover, .btn:focus { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- Status banners ----------------------------------------------------- */
.banner { border-radius: var(--radius-control); padding: 14px 16px; font-size: 0.9rem; margin: 0 0 16px; }
.banner.error { background: #fbeeec; color: var(--error); border: 1px solid #efcdc8; }
.banner.ok { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.banner .icon { font-weight: 700; margin-right: 6px; }

/* --- Success screen ----------------------------------------------------- */
.success { text-align: center; padding: 8px 0; }
.success .tick {
  width: 56px; height: 56px; border-radius: 50%;
  background: #E8F5E9; color: #2E7D32;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 12px;
}

.center { text-align: center; }
.muted { color: var(--text-secondary); }
.hidden { display: none !important; }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.legal {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.55;
}
footer.legal a { color: var(--text-secondary); }
footer.legal p { margin: 0 0 10px; }
footer.legal .footer-contact { font-size: 0.75rem; color: var(--text); }
footer.legal .footer-contact strong { color: var(--text); }
footer.legal .footer-note { color: var(--text-secondary); }
footer.legal .footer-copyright { margin-bottom: 0; font-size: 0.625rem; color: #8A8A8A; }

@media (max-width: 480px) {
  .wrap { padding: 20px 14px 48px; }
  .masthead .wordmark { font-size: 26px; }
}


/* =====================================================================
   Application-applet additions
   ===================================================================== */

/* Two-column profession checklist, collapsing to one column on phones */
.check-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
.check-grid .check-row { margin: 8px 0 2px; }

/* Yes / No radio pair */
.radio-row { display: flex; gap: 28px; margin: 6px 0 10px; }
.radio-option { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--text); cursor: pointer; }
.radio-option input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Terms of reference: readable bordered panel */
.tor-box {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--panel);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text);
}
.tor-box p { margin: 0 0 10px; }
.tor-box ul { margin: 0 0 10px; padding-left: 20px; }
.tor-box li { margin-bottom: 8px; }
.tor-box a { color: var(--secondary); }

/* Typed signature rendered in the Panel's handwriting font */
.sig-field { margin-top: 18px; }
input.sig-input {
  font-family: var(--font-brand);
  font-size: 1.9rem;
  line-height: 1.2;
  padding: 6px 12px;
  color: var(--text);
}
input.sig-input::placeholder { font-family: var(--font); font-size: 0.95rem; color: var(--text-secondary); }

@media (max-width: 480px) {
  .check-grid { grid-template-columns: 1fr; }
}


/* --- File uploads (adapted from the advance-information applet) --------- */
.dropzone {
  border: 1.5px dashed #c4ccbe;
  border-radius: var(--radius-control);
  padding: 18px 16px;
  text-align: center;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 44px;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--primary); background: #eef6ec; }
.dropzone strong { color: var(--primary); }
.dropzone.disabled { opacity: 0.55; pointer-events: none; }
.hidden-input { display: none; }

.upload-field { margin-top: 18px; }
.upload-field:first-child { margin-top: 4px; }

.file-item { padding: 10px 0 2px; }
.file-item .name { font-size: 0.9rem; color: var(--text); display: flex; justify-content: space-between; gap: 10px; }
.file-item .meta { font-size: 0.75rem; color: var(--text-secondary); }
.bar { height: 6px; background: #eceee8; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.file-item.done .state { color: var(--success); }
.file-item.error .state { color: var(--error); }
.state { font-size: 0.75rem; }
.file-remove {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px; padding: 9px 16px; min-height: 44px;
  font-size: 0.8rem; font-weight: 600; color: var(--secondary);
  background: #fff; border: 1.5px solid var(--border); border-radius: 999px;
  cursor: pointer; user-select: none;
}
.file-remove::before { content: "\2715"; font-size: 0.7rem; line-height: 1; }
.file-remove:hover, .file-remove:active { color: #B42318; border-color: #B42318; background: #FBEAEA; }
.file-remove:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Small green lead-ins inside the terms box */
.tor-box .tor-heading { margin: 12px 0 4px; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--secondary); }
.tor-box .tor-heading:first-of-type { margin-top: 2px; }

/* Generic optional tag (used beside the mailing-list checkbox) */
.check-row .optional-tag { display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-secondary); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin: 0 2px; }
