/* Bilby Bunch — clean, dependency-free stylesheet. */
:root {
  /* Bilby Bunch brand tokens (assets/brand.css is the source of truth) */
  --ink: #21332e;
  --ink-soft: #4f5e58;
  --paper: #faf7f1;
  --card: #ffffff;
  --line: #e7e2d5;
  --brand: #2e6e5e;      /* eucalyptus */
  --brand-dark: #235247;
  --accent: #e3a24a;     /* wattle/ochre */
  --ok: #2e6e5e;
  --bad: #b85c39;        /* red earth */
  --warn: #a86c22;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(33,51,46,.06), 0 6px 18px rgba(33,51,46,.05);
  --font-display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  /* Headline weight/tracking as overridable tokens (brand.py theme can dial
     these down for a less playful display face) — defaults are today's
     literal values, so Bilby Bunch's computed styles are unchanged. */
  --display-weight: 800;
  --display-tracking: -.02em;
  --line-strong: #d8d2c2;
  --paper-2: #f4efe4;
  --focus-ring: rgba(46,110,94,.1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--font-body);
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }
h1, h2, h3 { line-height: 1.15; color: var(--ink); font-family: var(--font-display); letter-spacing: var(--display-tracking); }
h1 { font-size: clamp(2rem, 4vw, 2.7rem); font-weight: var(--display-weight); margin: .2em 0 .35em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .5em; }
a { color: var(--brand); }
.meta { color: var(--ink-soft); font-size: .9rem; }
.muted { color: var(--ink-soft); }

/* Header / footer */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.brand .mark { width: 30px; height: 30px; color: var(--brand); display: inline-flex; }
.brand .mark svg { width: 100%; height: 100%; }
.nav { display: flex; align-items: center; gap: 16px; }
.navlink { text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 1rem; }
.navlink:hover { color: var(--brand-dark); }
.navlink.active { color: var(--brand); font-weight: 700; }
.site-footer { margin-top: 56px; padding: 26px 0; border-top: 1px solid var(--line); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 11px;
  border: 1.5px solid var(--line-strong); background: #fff; color: var(--ink); font-weight: 700;
  font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand-dark); background: #eef7f3; }
.btn-primary { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-primary:hover { background: #1c3f37; border-color: #1c3f37; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: .85rem; }
.btn-danger { color: var(--bad); border-color: #e7c4b8; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Cards / layout */
main { padding: 30px 0 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 28px; box-shadow: var(--shadow); margin: 18px 0; }
.card h2 { font-size: 1.45rem; }
@media (max-width: 760px) { .card { padding: 20px 18px; } }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.stat { font-family: var(--font-display); font-size: 2.9rem; font-weight: var(--display-weight); line-height: 1; color: var(--brand-dark); }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=number], input[type=datetime-local],
input[type=date], select, textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--line-strong); border-radius: 11px;
  font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
/* The dashboard write-box: one line taller, so the three-heading skeleton
   (Achievements / Help needed / Next steps) fits without scrolling. */
form[action*="project-update"] textarea { min-height: 104px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }
.field-hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }

/* Alerts */
.alert { padding: 12px 15px; border-radius: 8px; margin: 14px 0; font-size: .92rem; }
.alert-error { background: #fbeae3; border: 1px solid #e7c4b8; color: #7a2d12; }
.alert-info { background: #eaf2ef; border: 1px solid #c8ded6; color: var(--brand-dark); }
.alert-warn { background: #f4ecd5; border: 1px solid #e3d6a8; color: #6b561a; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* Profile: preference checkboxes + email address list */
.check { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check:last-of-type { border-bottom: 0; }
.check input { width: auto; margin: 3px 0 0; }
.email-list { list-style: none; margin: 8px 0 0; padding: 0; }
.email-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.email-row:last-child { border-bottom: 0; }
.email-addr { font-weight: 600; }
.email-actions { margin-left: auto; display: flex; gap: 6px; }
form.inline { display: inline; margin: 0; }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr; } }
/* Administration dropdown in the top bar */
details.nav-admin { position: relative; display: inline-block; }
details.nav-admin > summary { list-style: none; cursor: pointer; user-select: none; }
details.nav-admin > summary::-webkit-details-marker { display: none; }
.nav-admin-menu { position: absolute; right: 0; top: calc(100% + 12px); z-index: 60;
  display: flex; flex-direction: column; gap: 2px; min-width: 200px; padding: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 24px rgba(33,51,46,.10), 0 30px 60px rgba(33,51,46,.10); }
.nav-admin-menu .navlink { display: block; padding: 11px 14px; border-radius: 10px; font-weight: 600; color: var(--ink); }
.nav-admin-menu .navlink:hover { background: #eef7f3; color: var(--brand-dark); }

/* Attachment download chips */
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.attach { display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: .82rem; text-decoration: none; color: var(--ink); }
.attach:hover { border-color: var(--brand); color: var(--brand-dark); }
.attach-icon { font-size: .9em; }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.attach-size { color: var(--ink-soft); font-size: .92em; }
/* Chip + its optional remove (✕) control, kept together on wrap. The ✕ is a
   formaction submit button riding the surrounding form (never a nested form). */
.attach-wrap { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.attach-rm-btn { border: none; background: none; cursor: pointer; padding: 2px 5px;
  border-radius: 999px; color: var(--ink-soft); font-size: .8rem; line-height: 1; }
.attach-rm-btn:hover { color: #b3261e; background: rgba(179, 38, 30, .08); }

/* Tables / lists */
table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: .94rem; vertical-align: top; }
th { color: var(--ink-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.itemlist { list-style: none; margin: 0; padding: 0; }
.itemlist li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.itemlist li:last-child { border-bottom: 0; }

/* Pills / badges */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: #eceae2; color: #6f6a5d; line-height: 1.4; }
.pill-ok { background: #d8ece0; color: #2c6a5b; }
.pill-bad { background: #f4ddd2; color: var(--bad); }
.pill-warn { background: #f8e7c6; color: #996b1c; }
.pill-draft { background: #e7e5f4; color: #665ba8; }

/* Auto-save cue (see initAutosaveForm in app.js). The state reports INLINE next
   to the edited field: a brown dot while unsaved, then "Saving…" / "Saved ✓ hh:mm".
   The form-level chip is a fallback only for structural saves not tied to a field
   (the standing-agenda builder). Colours mirror the --ok/--warn/--bad tokens. */
.autosave-mark { margin-left: 8px; font-size: .78rem; font-weight: 700;
  white-space: nowrap; vertical-align: middle; }
.autosave-mark[data-state="dirty"] { display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; background: var(--warn); }
.autosave-mark[data-state="saving"] { color: var(--warn); animation: autosave-pulse 1s ease-in-out infinite; }
.autosave-mark[data-state="saved"] { color: var(--ok); animation: autosave-fade 2.5s forwards; }
.autosave-mark[data-state="error"] { color: var(--bad); }
/* Compare-and-swap conflict: stays put (no fade) until the user picks theirs/mine. */
.autosave-mark[data-state="conflict"] { color: var(--bad); }
/* A field locked while its conflict is unresolved — reads as un-editable so the
   user knows they must pick theirs/mine before typing more. */
.cas-locked { background: #f4ddd2; border-color: #e7c4b8; cursor: not-allowed; }
/* Author display rules above beat the UA [hidden] rule, so restore it explicitly
   — otherwise an empty, hidden indicator still shows as a stray grey pill. */
.autosave-mark[hidden], .autosave-status[hidden] { display: none; }
@keyframes autosave-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes autosave-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

.autosave-status { display: inline-block; margin: 0 0 12px; padding: 3px 11px;
  border-radius: 999px; font-size: .8rem; font-weight: 700; line-height: 1.4;
  background: #eceae2; color: #6f6a5d; }
.autosave-status[data-state="saving"] { background: #e7e5f4; color: #665ba8; }
.autosave-status[data-state="saved"] { background: #d8ece0; color: #2c6a5b; }
.autosave-status[data-state="error"] { background: #f4ddd2; color: var(--bad); }
.autosave-retry { border: none; background: none; cursor: pointer; font: inherit;
  font-weight: 700; text-decoration: underline; color: inherit; padding: 0 0 0 3px; }

/* Hero (home) */
.hero { padding: 56px 0 20px; }
.eyebrow { display: inline-block; color: var(--accent); font-weight: 700; font-size: .82rem;
  letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.display { font-size: 2.5rem; line-height: 1.08; margin: 0 0 .35em; }
.lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 40ch; }
.flow { display: grid; gap: 12px; grid-template-columns: repeat(5, 1fr); margin: 30px 0; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr 1fr; } .display { font-size: 2rem; } }
.flow .step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; font-size: .9rem; }
.flow .step b { display: block; color: var(--brand); margin-bottom: 4px; }

.agenda-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; background: var(--card); }
.agenda-item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.outcome-form { display: grid; gap: 10px; grid-template-columns: 1fr 1fr 1fr; margin-top: 10px; }
@media (max-width: 600px) { .outcome-form { grid-template-columns: 1fr; } .grid2 { grid-template-columns: 1fr; } }
.tally { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* Settings: left-nav + section body */
.settings-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; min-width: 168px; }
.settings-nav a { padding: 9px 13px; border-radius: 8px; color: var(--brand-dark); text-decoration: none; font-weight: 600; }
.settings-nav a.on { background: var(--brand-dark); color: #fff; }
.settings-nav a:hover:not(.on) { background: #eef7f3; }
.settings-body { flex: 1; min-width: 280px; }
.settings-body .card { margin-top: 0; }
/* The per-item assignee picker on the standing-agenda editor */
.ae-row .ae-assignee { max-width: 190px; flex: 0 0 auto; }
/* Multi-line member text (updates follow the Achievements/Help/Next-steps
   skeleton) keeps its line breaks wherever it's shown. */
.prewrap { white-space: pre-wrap; }
/* Pre-meeting Q&A under an agenda item: quiet, indented, text-sized. */
.iq { margin: 6px 0 0 2px; padding-left: 10px; border-left: 2px solid #e3e7ee; font-size: 0.93em; }
.iq-row { margin: 6px 0; }
.iq-answer { margin: 4px 0 0 14px; }
.iq-tag { font-weight: 700; color: #8a94a6; }
.iq-tag-a { color: #1f6b54; }
.iq-form { margin-top: 6px; }
.iq-form textarea { width: 100%; min-height: 54px; }
.iq-ask summary { cursor: pointer; }
/* The compact inline ask control — sits after the author name. CLOSED it's
   inline; OPEN it becomes a block so the question box lands on its own line
   below, instead of baseline-aligning its bottom with the heading line. */
.iq-ask-inline { display: inline-block; margin-left: 6px; vertical-align: baseline; }
.iq-ask-inline[open] { display: block; margin: 6px 0 0; }
.iq-ask-inline > summary { cursor: pointer; list-style: none; }
.iq-ask-inline > summary::-webkit-details-marker { display: none; }
.iq-ask-inline .iq-form { width: min(360px, 90vw); }
.iq-withdraw { border: none; background: none; cursor: pointer; padding: 0 2px; text-decoration: underline; }
/* Per-row agenda tools: quiet, text-sized, inline — arrows + bin, no chrome. */
.row-tools { display: inline-flex; align-items: center; gap: 1px; margin-left: 6px; vertical-align: baseline; }
.row-tools form { display: inline; margin: 0; }
.row-tools button { border: none; background: none; cursor: pointer; color: #8a94a6; font-size: 13px; line-height: 1; padding: 1px 3px; vertical-align: baseline; }
.row-tools button:hover { color: #1d2430; }
.row-tools svg { display: inline-block; vertical-align: -2px; }
.attach-link { display: inline-block; cursor: pointer; }
.attach-link:hover { text-decoration: underline; }
/* The input stays real (keyboard-focusable, no-JS fallback) but invisible —
   the label is the whole control and opens the file dialog in one click. */
.attach-link input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.ae-movegrp { flex: none; display: inline-flex; flex-direction: column; gap: 0; }
.ae-move { border: none; background: none; cursor: pointer; color: #99a; font-size: 10px; line-height: 1.1; padding: 0 4px; }
.ae-move:hover { color: #1d2430; }
/* Add-item button + add-a-group picker share one flex line (like .btn-row):
   each control keeps its own width and the pair wraps as whole units, so the
   button never shoves the picker's text and selects onto a ragged second line. */
.ae-addbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ae-addbar .ae-add { flex: 0 0 auto; }
.ae-addgroup { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ae-addgroup select.inp { width: auto; max-width: 200px; flex: 0 0 auto; }
@media (max-width: 600px) { .settings-nav { flex-direction: row; flex-wrap: wrap; } .ae-row .ae-assignee { max-width: none; } }

/* ---- "My teams" page: standing + role callout + team hierarchy --------- */
/* Main column (standing + teams) and the roles sidebar size independently, so a
   tall callout never pushes the teams section down the page. */
.teams-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr; gap: 18px; align-items: start; }
.teams-main { grid-column: 1; grid-row: 1; min-width: 0; }
.teams-grid .teams-directory { grid-column: 2; grid-row: 1; }
@media (max-width: 760px) {
  .teams-grid { grid-template-columns: 1fr; }
  .teams-main, .teams-grid .teams-directory { grid-column: 1; grid-row: auto; }
}
/* Right-hand directory of all active teams. */
.teams-directory h3 { margin-top: 0; }
.dir-list { list-style: none; margin: 6px 0 0; padding: 0; }
.dir-list li { padding: 9px 0; border-top: 1px solid var(--line); }
.dir-list li:first-child { border-top: 0; }
.dir-name { display: block; font-weight: 700; text-decoration: none; }

/* "what's this?" — a button that opens the roles modal (see .roles-dialog). */
.rolehelp-trigger { margin-left: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .82rem; font-weight: 600; color: var(--brand); white-space: nowrap;
  vertical-align: baseline; }
.rolehelp-trigger:hover { color: var(--brand-dark); }
.rolehelp-trigger::before { content: "?"; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-right: 4px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: .72rem; font-weight: 700; }

/* Roles explainer modal (native <dialog>, opened via app.js data-dialog-open). */
.roles-dialog { border: none; border-radius: 16px; padding: 0; width: 420px; max-width: 92vw;
  box-shadow: 0 18px 48px rgba(33,51,46,.28); }
.roles-dialog::backdrop { background: rgba(33,51,46,.38); }
.roles-dialog .rd-body { position: relative; padding: 20px 22px; }
.roles-dialog h3 { margin: 0 30px .4em 0; font-family: var(--font-display); }
.rd-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--ink-soft); padding: 2px 6px; }
.rd-close:hover { color: var(--ink); }
.standing-card h2 { margin-top: 0; }
.standing-card p { margin: .3em 0; }
.standing-badge { margin: 6px 0; }
.role-callout { background: var(--paper-2); }
.role-callout h3 { margin-top: 0; }
.role-list { list-style: none; margin: 6px 0 0; padding: 0; }
.role-list li { padding: 9px 0; border-top: 1px solid var(--line); }
.role-list li:first-child { border-top: 0; }
.role-list .role-name { display: block; font-weight: 700; margin-bottom: 2px; }
.role-list li.me .role-name { color: var(--brand-dark); }

/* The teams a member belongs to — a simple stack of cards. */
.team-list { margin: 10px 0 0; }
.team-card { background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); }
.team-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.team-name { font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.team-meta { margin: 10px 0 0; display: grid; gap: 8px; }
.team-meta > div { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: start; }
.team-meta dt { font-weight: 600; font-size: .82rem; color: var(--ink-soft); margin: 0; }
.team-meta dd { margin: 0; }
.team-meetings { list-style: none; margin: 0; padding: 0; }
.team-meetings li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 2px 0; }

/* "My organisation" page — read-only facts list. */
.org-facts { display: grid; gap: 10px; margin: 6px 0 0; }
.org-facts > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: start; }
.org-facts dt { font-weight: 600; color: var(--ink-soft); margin: 0; }
.org-facts dd { margin: 0; }
@media (max-width: 520px) { .org-facts > div { grid-template-columns: 1fr; gap: 2px; } }
