:root{
  --green:#2f6b3f; --green-dark:#24522f; --green-light:#eaf3ec;
  --gold:#c9a24b; --ink:#22301f; --muted:#5d6b58; --line:#dde5da;
  --bg:#f7f9f5; --card:#fff; --radius:14px;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Segoe UI',system-ui,-apple-system,sans-serif;color:var(--ink);background:var(--bg);line-height:1.6}
a{color:var(--green-dark)}
.wrap{max-width:1000px;margin:0 auto;padding:0 18px}

header{background:var(--green);position:sticky;top:0;z-index:10;box-shadow:0 2px 8px rgba(0,0,0,.15)}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:10px 18px;gap:12px;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:#fff}
.mark{width:38px;height:38px;border-radius:50%;background:var(--gold);color:var(--green-dark);font-weight:800;font-size:17px;display:flex;align-items:center;justify-content:center;flex:none}
.bname{font-weight:600;font-size:.98rem;line-height:1.2}
.bname small{display:block;font-weight:400;opacity:.85;font-size:.7rem}
header nav{display:flex;gap:2px;align-items:center;flex-wrap:wrap}
header nav a{color:#fff;text-decoration:none;padding:7px 11px;border-radius:8px;font-size:.9rem}
header nav a:hover{background:rgba(255,255,255,.18)}

.hero{background:linear-gradient(135deg,var(--green-dark),var(--green) 60%,#3f7d50);color:#fff;padding:52px 0;margin:0 -18px}
.hero h1{font-size:1.9rem;max-width:640px;line-height:1.15}
.hero p{max-width:620px;margin-top:12px}
.hero .btn{margin-top:10px}

main{min-height:60vh}
section{padding:36px 0}
section h1{color:var(--green-dark);font-size:1.6rem;margin-bottom:8px}
section h2{color:var(--green-dark);font-size:1.35rem;margin:18px 0 10px}
section h3{color:var(--green-dark);font-size:1.02rem;margin-bottom:6px}
.lead{color:var(--muted);max-width:680px;margin-bottom:16px}
.tint{background:var(--green-light);margin:0 -18px;padding:36px 18px}
.narrow{max-width:640px;margin:0 auto;padding-top:24px}
.narrow-card{max-width:640px}

.grid3{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;box-shadow:0 1px 3px rgba(34,48,31,.05);margin-bottom:14px}

.btn{display:inline-block;background:var(--green);color:#fff;font-weight:600;border:none;padding:10px 20px;border-radius:10px;font-size:.95rem;cursor:pointer;text-decoration:none}
.btn:hover{filter:brightness(1.08)}
.btn.gold{background:var(--gold);color:var(--green-dark)}
.btn.outline{background:transparent;border:1.5px solid rgba(255,255,255,.75);color:#fff;margin-left:8px}
.btn.small{padding:6px 13px;font-size:.85rem}
.btn.danger{background:#a33b2e}
header nav .btn.small{color:#fff}

form label{display:block;font-size:.85rem;font-weight:600;color:var(--green-dark);margin-bottom:12px}
form input,form select,form textarea{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:9px;font-family:inherit;font-size:.95rem;margin-top:4px;background:#fff}
form textarea{min-height:110px;resize:vertical}
form input:focus,form select:focus,form textarea:focus{outline:2px solid var(--green);border-color:var(--green)}
.row2{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:0 14px}
label.check{display:flex;gap:8px;align-items:flex-start;font-weight:400;font-size:.85rem;color:var(--ink)}
label.check input{width:auto;margin-top:3px}

.flash{margin:18px 0;padding:12px 16px;border-radius:10px;background:#e2f2e4;color:#2c6b36;font-size:.93rem}
.flash.err{background:#f9e5e2;color:#8f2f22}
.flash ul{margin-left:18px}

table{width:100%;border-collapse:collapse;background:var(--card);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;font-size:.9rem;margin-bottom:18px}
th,td{text-align:left;padding:9px 12px;border-bottom:1px solid var(--line)}
th{background:var(--green);color:#fff;font-size:.8rem}
tr:last-child td{border-bottom:none}
td.actions{display:flex;gap:6px}
td.actions form{display:inline}

.small{font-size:.85rem}
.muted{color:var(--muted)}

footer{background:var(--green-dark);color:#e8efe8;padding:22px 0;margin-top:30px;font-size:.88rem}
footer a{color:#fff}
.btn.outline2{background:#fff;color:var(--green);border:1.5px solid var(--green)}
.tag{display:inline-block;background:var(--green-light);color:var(--green-dark);border-radius:6px;padding:1px 8px;font-size:.78rem;font-weight:600}
/* Phase 5 — a tag for a state that is not yet settled: waiting for approval,
   declined, withdrawn. Gold rather than red: waiting is not an error. */
.tag.warn{background:#f7edd6;color:#7a5a12}
.meta{color:var(--muted);font-size:.8rem;margin-bottom:4px}

/* Phase 5 — the All / Mine switch on the issues register and the suggestions
   board, and the category filter beneath the suggestion form. */
.viewswitch{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 14px}

/* Phase 5 — wide tables scroll inside themselves rather than pushing the whole
   page sideways. Measured at 375px before this existed: the "Mine" issues table
   is 650px and took the body with it (293px of horizontal overflow), the
   suggestions board 566px (209px), and even the plain register overflowed by
   12px. A table that scrolls in its own box is readable on a phone; a page that
   scrolls sideways is not. */
.tablewrap{overflow-x:auto;max-width:100%}
.tablewrap table{margin-bottom:0}

/* Phase 4a — community feed, profiles */
.post-head{display:flex;gap:10px;align-items:center}
.avatar{display:inline-flex;align-items:center;justify-content:center}
.avatar-blank{background:var(--green-light);color:var(--green-dark);font-weight:700}
.post p{overflow-wrap:anywhere}
.post-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:10px}
.post-actions form{margin:0}
.comment{margin-left:18px;border-left:3px solid var(--green-light)}
.report-form{background:var(--green-light);border-radius:10px;padding:12px;margin-top:8px;max-width:420px}
.report-form label{margin-bottom:8px}
/* 5e — Like and Comment carry a word, not just an emoji and a number, and are
   tall enough to hit on a phone. Edit, Delete and Report are rarely needed, so
   they sit behind one ⋯ menu at the end of the row. The menu opens in the flow
   of the page (taking the full row) rather than as a floating dropdown: with no
   JavaScript nothing would close a dropdown, and one left open would cover the
   next post. */
.post-actions .btn.small{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:8px 14px;font-size:.9rem}
.post-actions .count{background:rgba(47,107,63,.12);border-radius:8px;padding:0 7px;font-size:.8rem}
.post-actions .btn:not(.outline2) .count{background:rgba(255,255,255,.25)}
.more{margin-left:auto}
.more[open]{flex-basis:100%}
.more>summary{display:block;width:max-content;margin-left:auto;list-style:none;min-width:40px;height:40px;line-height:40px;text-align:center;border-radius:10px;color:var(--muted);font-size:1.2rem;font-weight:700}
.more>summary::-webkit-details-marker{display:none}
.more>summary:hover,.more[open]>summary{background:var(--green-light);color:var(--green-dark)}
.more-panel{display:flex;flex-direction:column;align-items:flex-start;gap:10px;background:var(--green-light);border-radius:10px;padding:10px 14px;margin-top:6px}
.more-panel>details{align-self:stretch}
.more-panel details>summary,.more-panel a{font-size:.88rem;color:var(--green-dark)}
.more-panel .report-form{background:#fff}
.linkbtn{background:none;border:none;padding:0;font:inherit;font-size:.88rem;color:var(--green-dark);text-decoration:underline;cursor:pointer}
.linkbtn.danger{color:#a33b2e}
/* On a phone the row is ~277px wide at 360px; "Like 12" + "Comment 4" + the menu
   came to ~318px, so the menu dropped to a line of its own. Slimmer padding and
   the original .85rem button text bring it back to one line from 360px up.
   Height stays 40px, so the tap target is unchanged. */
@media (max-width:420px){
  .post-actions{gap:6px}
  .post-actions .btn.small{padding:8px 9px;gap:4px;font-size:.85rem}
  .post-actions .count{padding:0 5px}
  .more>summary{min-width:36px}
}
.rules{margin-left:20px;font-size:.92rem}
.rules li{margin-bottom:6px}
summary{cursor:pointer}

/* Phase 4b — messages */
.navbadge{display:inline-block;background:var(--gold);color:var(--green-dark);border-radius:9px;padding:0 6px;font-size:.72rem;font-weight:700;margin-left:2px}
.thread{display:flex;flex-direction:column;gap:8px;margin-top:12px;max-height:60vh;overflow-y:auto;padding-right:4px}
.msg{background:var(--green-light);border-radius:12px;padding:8px 12px;max-width:80%;align-self:flex-start}
.msg-mine{background:#fff;border:1px solid var(--line);align-self:flex-end}
.msg p{overflow-wrap:anywhere}

/* Phase 4d/5 — navigation. 4d gave the site its first media query, because
   before it the nav wrapped into four rows of green on a phone. Phase 5 makes
   the menu the nav at every width: with Settings added, the inline list ran to
   nine items (ten for an admin), which wraps to a second row inside the 1000px
   .wrap on a desktop too. Home sits outside the menu so it is always one click,
   and the panel drops out of flow so opening it never pushes the page down.
   Still a checkbox and a sibling selector — no JavaScript. */
.navbadge[hidden]{display:none}
.topbar{position:relative}

/* Home and Menu never move off the right-hand end, at any width.
 *
 * The bar stops wrapping altogether and the brand gives way instead: it is the
 * only flex item allowed to shrink, so whatever is left after the two buttons is
 * what the wordmark gets, truncated with an ellipsis if that is not enough.
 *
 * This replaces a breakpoint that hid the wordmark under 400px, which was picked
 * from a 375px test and was ~70px too low. Measured on the deployed build, the
 * bar wrapped between 401px and 469px — the brand wanted 238px, the buttons 192px
 * — and that band is where most phones sit in portrait: 412 (Pixel, Galaxy),
 * 414 (iPhone XR/11), 428-430 (iPhone Plus and Pro Max). A single wrapped item
 * then landed at the LEFT of the second row, because the bar is
 * justify-content:space-between. No width is special now, so there is no
 * equivalent number left to get wrong — including when the nav grows again. */
.topbar{flex-wrap:nowrap}
.brand{min-width:0}
.bname{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.navtools{display:flex;align-items:center;gap:8px;flex:none}
.navhome{display:inline-flex;align-items:center;gap:5px;color:#fff;text-decoration:none;font-size:.88rem;padding:7px 11px;border-radius:8px;background:rgba(255,255,255,.14);white-space:nowrap}
.navhome:hover{background:rgba(255,255,255,.28)}
/* Off-screen but focusable, so the menu is reachable by keyboard everywhere. */
.navtoggle{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.navburger{display:inline-flex;align-items:center;gap:6px;color:#fff;font-size:.88rem;padding:7px 11px;border-radius:8px;background:rgba(255,255,255,.14);cursor:pointer;user-select:none;white-space:nowrap}
.navburger:hover{background:rgba(255,255,255,.28)}
.navtoggle:focus-visible+.navtools .navburger{outline:2px solid #fff;outline-offset:2px}

header nav{display:none;position:absolute;top:100%;right:18px;z-index:20;
  min-width:230px;max-width:calc(100vw - 36px);flex-direction:column;align-items:stretch;gap:0;
  background:var(--green-dark);border-radius:0 0 12px 12px;padding:6px;
  box-shadow:0 10px 24px rgba(0,0,0,.28)}
.navtoggle:checked~nav{display:flex}
header nav a{padding:10px 12px;font-size:.94rem;border-radius:8px}
header nav .btn.small{margin-top:6px;text-align:center;background:rgba(255,255,255,.16);border-radius:8px}

@media (max-width:760px){
  .topbar{padding:9px 14px;gap:8px}
  .mark{width:32px;height:32px;font-size:15px}
  .bname{font-size:.86rem}
  .bname small{display:none}
  header nav{right:14px;left:14px;min-width:0;max-width:none}
}
/* On a phone the two buttons drop their words and keep their icons, which takes
   the pair from 192px to about 80px — enough that the full wordmark fits on
   every phone in portrait rather than being truncated on most of them. The
   ellipsis above is then only a backstop for the very narrowest screens.
   font-size:0 on the button hides its text without hiding it from a screen
   reader, and the icon comes back through a pseudo-element, so neither button
   needs its markup changed. .navbadge sets its own size in rem, not em, so the
   unread count is unaffected. */
@media (max-width:620px){
  /* 44x44 minimum: dropping the words took the buttons to 42x32, and a
     mis-tapped sticky header costs more than the 10px of header height this
     puts back. justify-content centres the icon inside the larger box. */
  .navhome, .navburger{font-size:0;gap:0;padding:6px 10px;
    min-width:44px;min-height:44px;justify-content:center}
  .navhome::before{content:"🏠";font-size:1.05rem;line-height:1}
  .navburger::before{content:"☰";font-size:1.15rem;line-height:1}
  .navbadge{margin-left:5px}
}

/* Phase 4d — dashboard. The activity strip replaces the old welcome line when
   there is something to report; the tiles replace six explanatory cards that
   restated the nav. */
.activity{display:flex;flex-wrap:wrap;gap:3px 9px;align-items:baseline;background:var(--card);border:1px solid var(--line);border-radius:10px;padding:9px 14px;font-size:.88rem;margin-bottom:18px}
.activity b{color:var(--green-dark)}
.activity a{color:var(--green-dark);text-decoration:none;border-bottom:2px solid var(--gold);padding-bottom:1px}
.activity a:hover{background:var(--green-light)}
.activity .sep{color:var(--line)}

/* The feed is the point of the residents' area, so its card is the one that
   carries weight. A tint rather than an accent rail: it would have been the
   only rail on the site. */
.card.primary{background:var(--green-light);border-color:#cbdfd1}
.card.primary h3{font-size:1.15rem}

/* Two columns, not auto-fit and no longer three: Phase 5 leaves five buttons,
   and five in a three-column grid strands two on a second row — the same fault
   auto-fit caused with six at 1000px. The first button spans both columns and
   the other four fill a 2x2 beneath it. */
.tiles{display:grid;gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
.tile{display:flex;align-items:center;gap:9px;min-width:0;text-decoration:none;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 15px}
.tile.wide{grid-column:1/-1;background:var(--green-light);border-color:#cbdfd1}
.tile.wide .lb{font-size:.98rem}
.tile:hover{border-color:var(--green);background:var(--green-light)}
.tile .ic{font-size:1rem;line-height:1;flex:none}
.tile .lb{font-weight:600;font-size:.88rem;color:var(--green-dark);min-width:0}
.tile .n{margin-left:auto;background:var(--green-light);color:var(--green-dark);border-radius:7px;padding:1px 7px;font-size:.72rem;font-weight:700;white-space:nowrap}
.tile .n.hot{background:var(--gold)}
.tile:hover .n{background:#fff}

/* "Yours" — the way back to what this resident lodged, and the count of what is
   still waiting on the committee. A line rather than a sixth button: it belongs
   to the resident, not to the estate, and the committee set the button list. */
.mineline{margin-top:14px;font-size:.86rem;color:var(--muted)}
.mineline a{color:var(--green-dark)}

.hhline{margin-top:20px;padding-top:12px;border-top:1px solid var(--line);font-size:.82rem;color:var(--muted)}

@media (max-width:520px){
  section{padding:20px 0}
  section h1{font-size:1.3rem}
  /* One column on a phone. Two cannot hold icon + label + pill at 375px
     without either scrolling sideways or breaking words mid-syllable — and the
     Phase 5 labels ("Community Noticeboard") are longer than the 4d ones. */
  .tiles{grid-template-columns:1fr;gap:8px}
  .tile{padding:12px 13px;gap:7px}
  .tile .n{padding:1px 6px;font-size:.7rem}
  .card{padding:14px 15px}
}
