/* Peer Support and Coaching Directory */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --sunk: #eaf0f7;
  --ink: #16243a;
  --muted: #55647a;
  --line: #d3dce8;
  --accent: #1d4f91;
  --accent-ink: #ffffff;
  --accent-soft: #e1ebf8;
  --warn: #9a5b00;
  --warn-soft: #fbf0d9;
  --bad: #a8323e;
  --bad-soft: #f8e1e3;
  --good: #1f5fa8;
  --good-soft: #dde9f8;
  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1520; --surface: #162131; --sunk: #111b28; --ink: #e5ecf5; --muted: #9aa9bd; --line: #2a3a51;
    --accent: #7fb2ef; --accent-ink: #0b1626; --accent-soft: #1a2e4a; --warn: #e5b45a; --warn-soft: #3a2f17;
    --bad: #f08a94; --bad-soft: #3d1f23; --good: #8cbcf2; --good-soft: #19304d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1520; --surface: #162131; --sunk: #111b28; --ink: #e5ecf5; --muted: #9aa9bd; --line: #2a3a51;
  --accent: #7fb2ef; --accent-ink: #0b1626; --accent-soft: #1a2e4a; --warn: #e5b45a; --warn-soft: #3a2f17;
  --bad: #f08a94; --bad-soft: #3d1f23; --good: #8cbcf2; --good-soft: #19304d; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font-body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; text-wrap: balance; font-weight: 600; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Header and footer */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-block: 14px; }
.logo { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); margin-right: auto; }
.logo b { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; }
.logo span { font-size: .82rem; color: var(--muted); }
.nav { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: .95rem; }
.nav a { text-decoration: none; color: var(--ink); }
.nav a:hover { color: var(--accent); }
.nav a.cta { background: var(--accent); color: var(--accent-ink); padding: 6px 14px; border-radius: 999px; }
.foot { margin-top: 48px; border-top: 1px solid var(--line); background: var(--surface); font-size: .88rem; color: var(--muted); }
.foot .wrap { padding-block: 22px; display: grid; gap: 8px; }
.crisis { color: var(--ink); }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); min-height: 42px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.small { min-height: 32px; padding: 4px 10px; font-size: .88rem; }
.btn[disabled] { opacity: .55; cursor: progress; }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=month], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: .86rem; }
.req { color: var(--bad); }

/* Search page */
.hero { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.hero .wrap { padding-block: 32px 26px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
.hero p { margin: 6px 0 18px; color: var(--muted); max-width: 62ch; }
.searchbar { display: grid; grid-template-columns: 1.1fr 1.4fr 1.4fr auto; gap: 10px; background: var(--surface); padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); }
.searchbar label { font-size: .8rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.searchbar .go { align-self: end; }
.tele { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .92rem; }
.tele input { width: 18px; height: 18px; }
.layout { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding-top: 24px; }
.filters { align-self: start; display: grid; gap: 12px; }
.filter-body { display: grid; gap: 12px; }
.filters h2 { font-size: 1.05rem; }
.filters .btn { width: 100%; }
.filter-toggle { display: none; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.results-head h2 { font-size: 1.15rem; }
.cards { display: grid; gap: 14px; }
.card { display: grid; grid-template-columns: 104px 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card:hover { border-color: var(--accent); }
.card > a { text-decoration: none; }
.photo { width: 104px; height: 104px; border-radius: 10px; object-fit: cover; background: var(--sunk); display: grid; place-items: center; font-family: var(--font-head); font-size: 2rem; color: var(--muted); }
.card h3 { font-size: 1.2rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); text-decoration: underline; }
.pron { font-weight: 400; color: var(--muted); font-size: .9rem; font-family: var(--font-body); }
.title { margin: 2px 0 6px; color: var(--muted); }
.cred-line { font-size: .9rem; margin: 0 0 6px; }
.where { font-size: .9rem; color: var(--muted); margin: 0 0 8px; }
.card .about { margin: 0 0 10px; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .82rem; }
.card-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-top: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.self { background: var(--sunk); color: var(--muted); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); }
.notice { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 6px; font-size: .92rem; }
.notice.good { background: var(--good-soft); border-color: var(--good); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad); white-space: pre-line; }

/* Profile page */
.profile { display: grid; grid-template-columns: 1fr 320px; gap: 28px; padding-top: 24px; }
.p-head { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.p-head .photo { width: 150px; height: 150px; font-size: 3rem; }
.p-head h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 16px; }
.panel h2 { font-size: 1.2rem; margin-bottom: 10px; }
.panel h3 { font-size: 1rem; margin: 14px 0 6px; font-family: var(--font-body); font-weight: 700; }
.panel p { margin: 0 0 10px; white-space: pre-line; }
.creds { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.creds li { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.creds .cn { font-weight: 700; }
.creds dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; font-size: .9rem; }
.creds dt { color: var(--muted); }
.creds dd { margin: 0; }
.side .panel:first-child { margin-top: 0; }
.facts { display: grid; gap: 10px; margin: 0; }
.facts dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: 0 0 4px; }
.contact a.btn { width: 100%; margin-top: 8px; }
.disclaimer { font-size: .85rem; color: var(--muted); }

/* Join and edit form */
.form-page { max-width: 860px; }
.steps { display: grid; gap: 18px; padding-top: 24px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 18px 20px 20px; margin: 0; min-width: 0; }
legend { font-family: var(--font-head); font-size: 1.2rem; font-weight: 600; padding: 0 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field { margin-top: 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 14px; margin-top: 6px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .94rem; margin: 0; padding: 3px 0; }
.checks input { margin-top: 4px; width: 17px; height: 17px; flex: none; }
.cred-row { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 12px; background: var(--bg); position: relative; }
.cred-row h3 { font-size: 1rem; font-family: var(--font-body); margin-bottom: 4px; }
.cred-row .remove { position: absolute; top: 10px; right: 10px; }
.photo-pick { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.counter { font-size: .8rem; color: var(--muted); text-align: right; }
.pricebox { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.pricebox .price { font-family: var(--font-head); font-size: 1.45rem; font-weight: 600; line-height: 1.25; }
.pricebox .price-label { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; }
.pricebox .hint { max-width: 300px; }
.pricebox ul { margin: 0; padding-left: 18px; font-size: .94rem; }
.submit-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.done-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 12px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.admin-table .acts { display: flex; flex-wrap: wrap; gap: 4px; }

@media (max-width: 860px) {
  .searchbar { grid-template-columns: 1fr 1fr; }
  .searchbar .go { grid-column: 1 / -1; }
  .layout, .profile { grid-template-columns: 1fr; }
  .filter-toggle { display: inline-flex; }
  .filters:not(.open) .filter-body { display: none; }
  .filter-body { display: grid; gap: 12px; }
}
@media (max-width: 560px) {
  .searchbar { grid-template-columns: 1fr; }
  .card { grid-template-columns: 72px 1fr; gap: 12px; padding: 14px; }
  .card .photo { width: 72px; height: 72px; font-size: 1.5rem; }
  .p-head { grid-template-columns: 96px 1fr; gap: 14px; padding: 16px; }
  .p-head .photo { width: 96px; height: 96px; font-size: 2rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  fieldset { padding: 14px; }
  .pricebox { grid-template-columns: 1fr; padding: 14px; }
  .admin-table { display: block; overflow-x: auto; }
}

/* Multi-choice drop-downs */
.ms { position: relative; }
.ms details > summary { list-style: none; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 34px 9px 11px; min-height: 42px; position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms details > summary::-webkit-details-marker { display: none; }
.ms details > summary::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.ms details[open] > summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ms.has-value details > summary { border-color: var(--accent); font-weight: 600; }
.ms-panel { position: absolute; z-index: 50; left: 0; right: 0; min-width: 240px; margin-top: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .14); padding: 8px 10px; max-height: 320px; overflow-y: auto; }
.ms-panel label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: .94rem; margin: 0; padding: 5px 2px; cursor: pointer; }
.ms-panel input { margin-top: 4px; width: 17px; height: 17px; flex: none; }
.ms-panel input:disabled + * , .ms-panel label:has(input:disabled) { color: var(--muted); }
.ms-max { margin: 0 0 4px; }
.ms-actions { position: sticky; bottom: -8px; display: flex; justify-content: flex-end; gap: 8px; background: var(--surface); padding: 8px 0 2px; border-top: 1px solid var(--line); margin-top: 6px; }
