/* Wildwood Hills Estates resident app
   Layout: one phone-width column, photo hero on Home, white cards on a sage ground, fixed tab bar. */

:root {
  --bg: #F3F6F1;
  --surface: #FFFFFF;
  --line: #DDE5DA;
  --line-soft: #EDF1EB;
  --ink: #16201B;
  --muted: #5B6660;
  --accent: #1F4D3A;
  --accent-ink: #FFFFFF;
  --link: #1F4D3A;
  --sage: #D0DFCD;
  --sage-ink: #1F4D3A;
  --tint: #E6EEE3;
  --warn-bg: #FBF0D9;  --warn-ink: #7A4B00;
  --ok-bg: #DCEFE2;    --ok-ink: #1E5B35;
  --info-bg: #E2ECF8;  --info-ink: #1E4C86;
  --bad-bg: #F8E1DC;   --bad-ink: #8A2B17;
  --date: #B4361E;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.16);

  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1612; --surface: #18221C; --line: #2A3830; --line-soft: #223029;
    --ink: #E7EEE9; --muted: #9AA9A0; --accent: #2F6B50; --accent-ink: #FFFFFF; --link: #8CC9A5;
    --sage: #24392C; --sage-ink: #A9D3B5; --tint: #1F2C24;
    --warn-bg: #3A2E12; --warn-ink: #F2C877; --ok-bg: #183424; --ok-ink: #9FDAB4;
    --info-bg: #16273D; --info-ink: #9CC3F0; --bad-bg: #3A1C16; --bad-ink: #F0A897;
    --date: #F08A70; --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1612; --surface: #18221C; --line: #2A3830; --line-soft: #223029;
  --ink: #E7EEE9; --muted: #9AA9A0; --accent: #2F6B50; --accent-ink: #FFFFFF; --link: #8CC9A5;
  --sage: #24392C; --sage-ink: #A9D3B5; --tint: #1F2C24;
  --warn-bg: #3A2E12; --warn-ink: #F2C877; --ok-bg: #183424; --ok-ink: #9FDAB4;
  --info-bg: #16273D; --info-ink: #9CC3F0; --bad-bg: #3A1C16; --bad-ink: #F0A897;
  --date: #F08A70; --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--ink); }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { text-wrap: balance; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Screen frame ---------- */
.screen {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
.pad { padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.page-head {
  padding-top: calc(env(safe-area-inset-top, 0px) + 28px);
  padding-bottom: 6px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.page-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.12; letter-spacing: -0.01em; }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-weight: 600; font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 20px; }

.sample-strip {
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: 12px; font-weight: 700; text-align: center;
  padding: 6px var(--gutter-r) 6px var(--gutter-l);
}

/* ---------- Cards & controls ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.card-pad { padding: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-small { min-height: 40px; padding: 0 14px; }
.pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill-info { background: var(--info-bg); color: var(--info-ink); }
.pill-bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill-neutral { background: var(--tint); color: var(--muted); }
.role { font-size: 11px; font-weight: 700; color: var(--sage-ink); background: var(--sage); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chev { flex-shrink: 0; color: var(--muted); }

/* ---------- Home hero ---------- */
.hero-wrap { position: relative; }
.hero { position: relative; height: calc(250px + env(safe-area-inset-top, 0px)); overflow: hidden; }
.hero-img { width: 100%; height: 100%; object-fit: cover; object-position: center 78%; display: block; }
.hero-shade { position: absolute; inset: 30% 0 0 0; background: linear-gradient(to top, rgba(10, 24, 17, 0.8), rgba(10, 24, 17, 0)); }
.hero-top {
  position: absolute; left: var(--gutter-l); right: var(--gutter-r);
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  display: flex; justify-content: space-between; align-items: center;
}
.hero-greeting { position: absolute; left: var(--gutter-l); right: var(--gutter-r); bottom: 38px; color: #FFFFFF; }
.hero-greeting .date { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #E6EEE3; }
.hero-greeting h1 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.1; }
.brand-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 7px;
  border-radius: 12px; background: #FFFFFF; box-shadow: var(--shadow);
}
.wordmark { display: flex; flex-direction: column; font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.05; color: #1F4D3A; }
.avatar-btn {
  width: 44px; height: 44px; border-radius: 22px; border: none; background: #FFFFFF;
  color: #1F4D3A; font-weight: 700; font-size: 16px; box-shadow: var(--shadow);
}
.profile-menu {
  position: absolute; right: var(--gutter-r); top: calc(env(safe-area-inset-top, 0px) + 64px);
  width: min(260px, calc(100% - 40px)); z-index: 5; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow);
}
.sheet {
  position: relative; margin-top: -22px; border-radius: 22px 22px 0 0; background: var(--bg);
  padding-top: 18px;
}

/* Home pieces */
.req-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.req-body { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 10px; }
.req-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.2; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.3;
}
.tile-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--sage); color: var(--sage-ink); display: flex; align-items: center; justify-content: center; }
.row-link { display: flex; gap: 14px; align-items: center; padding: 12px 14px; color: var(--ink); }
.datebox { width: 50px; flex-shrink: 0; border-radius: 12px; background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 5px 0; }
.datebox .m { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--date); }
.datebox .d { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.1; }
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.serif-17 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.small { font-size: 13px; }
.tag { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--link); }

/* ---------- Directory ---------- */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; color: var(--ink); }
.search:focus-within { border-color: var(--link); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r));
  padding: 2px var(--gutter-r) 2px var(--gutter-l);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600;
}
.chip-menu { display: inline-flex; align-items: center; gap: 4px; }
.chip-caret { display: inline-flex; }
.chips-sub .chip { background: var(--tint); }
.role-type { background: var(--tint); color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.group { display: flex; flex-direction: column; gap: 8px; }
.person { border-bottom: 1px solid var(--line-soft); }
.person:last-child { border-bottom: none; }
.person summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; min-height: 64px;
}
.person summary::-webkit-details-marker { display: none; }
.person[open] summary .chev { transform: rotate(90deg); }
.avatar {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 20px; background: var(--sage); color: var(--sage-ink);
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.person-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.person-position { font-size: 13px; font-weight: 700; color: var(--link); }
.person-detail { padding: 0 14px 14px 66px; display: flex; flex-direction: column; gap: 8px; }
.detail-row { display: flex; align-items: center; gap: 10px; min-height: 40px; color: var(--ink); overflow-wrap: anywhere; }
.detail-row svg { color: var(--link); flex-shrink: 0; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }

/* ---------- Property ---------- */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 4px; background: var(--line-soft); border-radius: 12px; }
.segmented button { min-height: 40px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.req-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.req-note { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; padding: 10px 12px; border-radius: 12px; background: var(--bg); font-size: 14px; line-height: 1.45; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item .grow { gap: 3px; }
.tl-dot { width: 12px; height: 12px; flex-shrink: 0; margin-top: 4px; border-radius: 6px; background: var(--accent); }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 18px; bottom: 2px; width: 2px; background: var(--line); }
.tl-item:last-child .tl-dot { background: var(--sage); }

.file-list li { border-bottom: 1px solid var(--line-soft); }
.file-list li:last-child { border-bottom: none; }
.file-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; color: var(--ink); }
.tl-item .file-list { margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; }
.tl-item .file-row { min-height: 48px; padding: 6px 10px; }
.file-thumb { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: var(--tint); }

/* ---------- Calendar ---------- */
.row-link .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rsvp-note { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: var(--ok-ink); }
.rsvp-buttons, .btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.rsvp-buttons .btn { flex: 1 1 140px; }
.rsvp-done { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--ok-ink); font-weight: 700; }
.event-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; background: var(--tint); }
#rsvpMsg:empty { display: none; }

/* ---------- Alteration request form ---------- */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 15px; }
.facts dt { font-weight: 700; color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.mini-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
input[type="date"].input { min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; padding: 12px 10px; }
select.input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7A70' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
input[type="date"].input { min-height: 48px; }
.fold summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; min-height: 28px; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: '+'; font-size: 22px; color: var(--muted); margin-left: 8px; }
.fold[open] summary::after { content: '–'; }
.fold summary .small { margin-left: auto; }
.check-row { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; cursor: pointer; }
.check-row input { width: 22px; height: 22px; flex-shrink: 0; margin: 1px 0 0; accent-color: var(--accent); }
.form-msg { color: var(--bad-ink); }
.form-msg:empty { display: none; }
.upload-list { border: 1px solid var(--line); border-radius: 12px; }
.upload-item { display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 12px; border-bottom: 1px solid var(--line-soft); }
.upload-item:last-child { border-bottom: none; }
.success-card { align-items: flex-start; }
.success-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-ink); display: flex; align-items: center; justify-content: center; }
.confirm-box { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-radius: 12px; background: var(--tint); width: 100%; }
.confirm-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; font-weight: 700; letter-spacing: 0.12em; }

.notice-card { background: var(--warn-bg); border-color: transparent; color: var(--warn-ink); }
.bullets { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.terms summary { color: var(--link); }
.terms summary::after { content: ''; }
.terms .numbered { margin-top: 10px; }

/* ---------- Guidelines ---------- */
.rich-text { line-height: 1.6; font-size: 15px; overflow-wrap: anywhere; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 10px; }
.rich-text h3, .rich-text h4, .rich-text h5 { font-family: var(--font-display); margin: 16px 0 6px; line-height: 1.3; }
.rich-text ul, .rich-text ol { margin: 0 0 10px; padding-left: 22px; }
.rich-text li { margin-bottom: 4px; }
.rich-text li p { margin: 0; }
.rich-text blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--sage); color: var(--muted); }
.rich-text hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.rt-table { overflow-x: auto; margin-bottom: 10px; }
.rt-table table { border-collapse: collapse; font-size: 14px; }
.rt-table td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.rt-img { max-width: 100%; border-radius: 10px; margin: 6px 0; }
.guide { border-bottom: 1px solid var(--line-soft); }
.guide:last-child { border-bottom: none; }
.guide summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 14px; cursor: pointer; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary .chev { transition: transform .15s; }
.guide[open] summary .chev { transform: rotate(90deg); }
.guide-body { padding: 0 14px 16px; }
.guide-figure { display: block; margin-bottom: 12px; border-radius: 12px; overflow: hidden; background: var(--tint); }
.guide-figure img { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }

/* ---------- Governing documents ---------- */
.gov-official { padding: 10px 12px; border-radius: 12px; background: var(--tint); color: var(--muted); line-height: 1.45; }
.gov-body { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.gov-body p { margin: 0 0 10px; }
.gov-sec strong { color: var(--ink); }
.gov-li { display: flex; gap: 8px; margin: 0 0 8px; padding-left: 4px; }
.gov-li.lvl1 { padding-left: 28px; }
.gov-li.lvl2 { padding-left: 52px; }
.gov-label { flex-shrink: 0; min-width: 26px; font-weight: 600; color: var(--muted); }
.gov-sub { font-family: var(--font-display); font-size: 16px; margin: 14px 0 6px; }
.gov-quote { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--sage); background: var(--tint); border-radius: 0 10px 10px 0; }
.gov-amend { display: flex; gap: 8px; align-items: flex-start; margin: -4px 0 12px; padding: 8px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; line-height: 1.45; }
.gov-amend svg { flex-shrink: 0; margin-top: 2px; }
.gov-amend a { color: inherit; font-weight: 700; }
.gov-note { font-style: italic; color: var(--muted); }
.gov-sig { display: flex; flex-direction: column; margin: 4px 0 14px 32px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 14px; line-height: 1.5; }
.gov-sig span:first-child { font-weight: 600; }
.gov-recorded { font-size: 14px; font-style: italic; padding-top: 10px; border-top: 1px solid var(--line); }
mark { background: #FCE7A6; color: inherit; border-radius: 3px; padding: 0 1px; }
.hit { align-items: flex-start; }
.hit-text { display: block; font-size: 14px; line-height: 1.45; }

/* ---------- Forum ---------- */
.post-card { display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.post-meta { display: flex; align-items: center; gap: 10px; }
.pinned-note { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--muted); }
.post-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; line-height: 1.3; }
.post-excerpt { color: var(--muted); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-thumbs { display: flex; gap: 6px; }
.post-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--tint); }
.post-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.reply-count { display: inline-flex; align-items: center; gap: 4px; }
.post-body, .reply-body { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.55; }
.post-body { font-size: 16px; }
.post-photos { display: grid; gap: 8px; }
.post-photos img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; background: var(--tint); display: block; }
.reply-head { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.reply { padding: 14px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.reply:last-child { border-bottom: none; }
.reply-body { padding-left: 42px; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--muted); border-radius: 10px; }
.icon-btn:hover { background: var(--tint); }
.btn-quiet { color: var(--bad-ink); }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 14px; position: sticky; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 4px 18px rgba(0,0,0,.06); }
.composer textarea { flex: 1; min-width: 0; border: none; outline: none; resize: none; background: transparent; font: inherit; font-size: 16px; color: var(--ink); padding: 9px 0; max-height: 200px; }
.composer .btn { width: 44px; padding: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; flex-shrink: 0; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 700; }
.input { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; padding: 12px 14px; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--link); }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-tile { width: 92px; height: 92px; border-radius: 12px; overflow: hidden; position: relative; background: var(--tint); display: flex; align-items: center; justify-content: center; text-align: center; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { border: 1.5px dashed var(--line); color: var(--muted); flex-direction: column; gap: 2px; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #FFFFFF; font-size: 18px; line-height: 1; }

/* ---------- Documents ---------- */
.feature-link { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); }
.feature-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: #FFFFFF; color: #1F4D3A; display: flex; align-items: center; justify-content: center; }
.doc-row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 14px; color: var(--ink); border-bottom: 1px solid var(--line-soft); }
.list li:last-child .doc-row { border-bottom: none; }
.file-badge { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--bad-bg); color: var(--bad-ink); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; }

/* ---------- Coming soon ---------- */
.soon { padding: 22px 18px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.soon h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
}
.tabbar-inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tab {
  min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.tab[aria-current="page"] { color: var(--link); font-weight: 700; }

/* ---------- Sign in ---------- */
.signin { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.signin-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.signin-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 24, 17, 0.92) 35%, rgba(10, 24, 17, 0.15)); }
.signin-body {
  position: relative; max-width: 520px; width: 100%; margin: 0 auto;
  padding-top: 40px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 40px);
  display: flex; flex-direction: column; gap: 18px; color: #FFFFFF;
}
.signin-brand { display: flex; align-items: center; gap: 14px; }
.signin-brand .wordmark { font-size: 26px; color: #FFFFFF; }
.signin p { margin: 0; color: #E6EEE3; max-width: 34ch; }
.signin .btn-primary { background: #FFFFFF; color: #1F4D3A; border-color: #FFFFFF; min-height: 52px; font-size: 16px; }
.signin .fine { font-size: 13px; color: #C9D6CC; }

.error-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

@media (prefers-reduced-motion: no-preference) {
  .person summary .chev { transition: transform 0.15s ease; }
}

/* =========================================================
   Larger screens. The app picks its layout from the screen width:
   phone (default) · tablet (700px+) · desktop and iPad landscape (1024px+).
   ========================================================= */
.tabbar-brand, .tab-wide-only { display: none; }

@media (min-width: 700px) {
  :root { --gutter-l: max(32px, env(safe-area-inset-left, 0px)); --gutter-r: max(32px, env(safe-area-inset-right, 0px)); }
  .screen { max-width: 760px; }
  .tabbar-inner { max-width: 640px; }
  .page-title { font-size: 34px; }
  .hero { height: calc(300px + env(safe-area-inset-top, 0px)); }
  .hero-greeting h1 { font-size: 36px; }
  .card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .card-grid > .card.empty { grid-column: 1 / -1; }
  .tiles { gap: 14px; }
  .tile { padding: 18px 10px; font-size: 14px; }
  #reqForm, #postForm { max-width: 640px; }
  .post-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-photos a:only-child { grid-column: 1 / -1; }
  .signin-body { max-width: 560px; }
}

@media (min-width: 1024px) {
  :root { --sidebar-w: 248px; }
  body { background: var(--bg); }
  .screen {
    max-width: 920px; margin: 0 0 0 var(--sidebar-w); margin-left: calc(var(--sidebar-w) + max(0px, (100vw - var(--sidebar-w) - 920px) / 2));
    padding-bottom: 48px;
  }
  /* The tab bar becomes a sidebar */
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); border-top: none; border-right: 1px solid var(--line);
    padding: 24px 14px; display: flex; flex-direction: column; gap: 22px;
  }
  .tabbar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--ink); }
  .tabbar-brand .wordmark { color: var(--ink); }
  .tabbar-inner { max-width: none; margin: 0; display: flex; flex-direction: column; gap: 4px; }
  .tab, .tab-wide-only {
    display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 46px;
    padding: 0 14px; border-radius: 12px; font-size: 15px; color: var(--ink);
  }
  .tab:hover { background: var(--tint); }
  .tab[aria-current="page"] { background: var(--sage); color: var(--sage-ink); }
  .composer { bottom: 16px; }
  .page-head { padding-top: 40px; }
  /* Home: the photo becomes a framed banner */
  .hero-wrap { padding: 24px var(--gutter-r) 0 var(--gutter-l); }
  .hero { height: 320px; border-radius: 24px; }
  .hero-top .brand-chip { display: none; }
  .sheet { margin-top: 20px; border-radius: 0; background: transparent; padding-top: 0; }
  .profile-menu { top: 88px; right: calc(var(--gutter-r) + 20px); }
  .card-grid { gap: 14px; }
}
