:root {
  --bg: #f6f7f5; --panel: #ffffff; --ink: #14201a; --muted: #56645c; --line: #d6ddd8;
  --accent: #262a6e; --accent-ink: #ffffff; --accent-soft: #e8e9f6; --teal: #14a99a;
  --ok: #0f6b45; --warn: #8a5a00; --error: #b3261e;
  --radius: 12px; --pad: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411; --panel: #161e1a; --ink: #e6efe9; --muted: #9db0a5; --line: #2a3630;
    --accent: #9ba1f2; --accent-ink: #0e1033; --accent-soft: #23264d; --teal: #3cc8b6;
    --ok: #4fc48c; --warn: #e8b04a; --error: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1411; --panel: #161e1a; --ink: #e6efe9; --muted: #9db0a5; --line: #2a3630;
  --accent: #9ba1f2; --accent-ink: #0e1033; --accent-soft: #23264d; --teal: #3cc8b6;
  --ok: #4fc48c; --warn: #e8b04a; --error: #ff8a80;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { background: var(--panel); border-bottom: 1px solid var(--line); }
.bar { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 19px; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand img { flex: none; }
.brand small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
nav { display: flex; gap: 8px; flex-wrap: wrap; }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; overflow-wrap: anywhere; }
.stack > *, .row > * { min-width: 0; }
.addr-short { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; text-decoration: underline dotted; cursor: pointer; }
h1 { font-size: 26px; line-height: 1.25; margin: 4px 0 8px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
h3 { font-size: 18px; margin: 4px 0 6px; }
p { margin: 6px 0; }
.muted, .eyebrow { color: var(--muted); }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin: 12px 0; }
.big { font-size: 20px; font-weight: 700; }
button { font: inherit; min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .55; cursor: not-allowed; }
nav button { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.stack { display: grid; gap: 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 4px; }
.choice { font-weight: 600; }
.choice.picked { background: var(--accent-soft); border-color: var(--accent); }
select { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; font: inherit; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.stack > * { min-width: 0; max-width: 100%; }
input[type=text], input[type=email], input[type=search], input[type=number], input[type=date], input[type=url], textarea { font: inherit; font-size: max(16px, 1rem); width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; word-break: break-all; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin: 8px 0; }
.status { min-height: 1.5em; margin: 8px 0 0; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .error { color: var(--error); }
details { margin-top: 10px; } summary { cursor: pointer; color: var(--muted); }
ul.tally { list-style: none; padding: 0; margin: 8px 0 0; }
ul.tally li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.note { font-size: 14px; color: var(--muted); }
[hidden] { display: none !important; }
.copy-btn { min-height: 36px; padding: 4px 12px; font-size: 14px; margin: 0 0 8px; }
ul.rules { list-style: none; padding: 0; margin: 0; } ul.rules li { padding: 10px 0; border-top: 1px solid var(--line); } ul.rules li:first-child { border-top: 0; }
.budget-rows { list-style: none; padding: 0; margin: 0; }
.budget-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.budget-row:first-child { border-top: 0; }
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper button { min-width: 44px; padding: 6px 0; font-size: 20px; }
.stepper .n { min-width: 2ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.credits { font-weight: 600; }
.thread summary { cursor: pointer; color: var(--muted); }
.comment { border-top: 1px solid var(--line); padding: 8px 0; }
.comment:first-child { border-top: 0; }
.stars button { min-width: 0; padding: 6px 10px; font-size: 14px; }
.explainer summary { cursor: pointer; font-weight: 600; }
.explainer ul { margin: 4px 0; padding-left: 20px; }

.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text, inherit); margin-left: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.filters button { min-height: 40px; padding: 6px 14px; }
.filters button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.attention { list-style: none; padding: 0; margin: 0; }
.attention li { border-top: 1px solid var(--line); padding: 10px 0 10px 12px; border-left: 4px solid transparent; }
.attention li:first-child { border-top: 0; }
.attention li.urgent { border-left-color: var(--error); }
.attention li.soon { border-left-color: var(--warn); }
.attention li.upcoming { border-left-color: var(--line); }
.attention .lvl { font-weight: 700; }
.attention li.urgent .lvl { color: var(--error); }
.attention li.soon .lvl { color: var(--warn); }
.attention .meta { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.rules-summary { margin: 4px 0; padding-left: 20px; }
table.data tr.against td { background: color-mix(in srgb, var(--warn) 12%, transparent); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
#toasts { position: fixed; left: 12px; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel); border: 2px solid var(--warn); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; box-shadow: 0 6px 24px rgb(0 0 0 / 20%); font-weight: 600; }
.toast button { min-height: 40px; }
.countdown { font-variant-numeric: tabular-nums; white-space: nowrap; }
.countdown.soon { color: var(--warn); font-weight: 600; }
.countdown.urgent { color: var(--error); font-weight: 700; }
.attn-tools { gap: 12px; margin: 6px 0 0; font-size: 14px; }
.attn-tools button { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.attn-tools button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.attach-buttons { gap: 8px; flex-wrap: wrap; }
label.button { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; font-weight: 600; }
.attach-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; vertical-align: middle; }
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 8px 0; }
.attachment { margin: 0; }
.attachment img { width: 100%; height: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.attachment figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.attachment .ai-text { white-space: pre-wrap; max-height: 240px; overflow: auto; font-size: 13px; background: var(--bg); padding: 8px; border-radius: 8px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; font-size: 13px; cursor: pointer; }
button.copy { min-height: 32px; padding: 2px 10px; font-size: 13px; border-radius: 8px; vertical-align: middle; }
button.copy.copied { border-color: var(--accent); background: var(--accent-soft); }
.section-menu { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; margin: 0 0 8px; overflow-x: auto; flex-wrap: nowrap; }
.section-menu a.button { white-space: nowrap; text-decoration: none; color: inherit; min-height: 40px; }
a.button { display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.todo { border-color: var(--accent); }
.todo-list li a { font-weight: 600; }
.flash { animation: flash 2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.whats { font-size: 14px; font-weight: 400; margin-left: 6px; }
.help-section summary { cursor: pointer; }
dl.glossary dt { font-weight: 700; margin-top: 8px; }
dl.glossary dd { margin: 0 0 4px; }
.item-tools { gap: 8px; flex-wrap: wrap; font-size: 13px; margin: 4px 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#home-search { margin: 8px 0; }
.search-results li .eyebrow { margin-bottom: 2px; }
details.faq { border-top: 1px solid var(--line); padding: 8px 0; }
details.faq summary { cursor: pointer; }
.pbar { height: 12px; background: var(--accent-soft); border-radius: 6px; overflow: hidden; }
.pbar span { display: block; height: 100%; background: var(--accent); }
.milestones li.overdue strong { color: var(--error); }
.milestones li.done { color: var(--muted); }
/* Search boxes: full-size text (iPhone zooms in on anything smaller than 16px), beside their button. */
form[role=search] { flex-wrap: nowrap; }
form[role=search] input[type=search] { width: auto; min-width: 0; -webkit-appearance: none; appearance: none; }

.lang-switch { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
.tagline { color: var(--teal); font-weight: 600; margin-top: -4px; }
.org-name { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.brand:has(.org-name:not([hidden])) { flex-direction: column; align-items: flex-start; gap: 0; }

.council-section { margin: 14px 0 2px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Assistant */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.assistant-msg { padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); overflow-wrap: anywhere; }
.assistant-msg.me { background: var(--accent-soft); margin-left: 15%; }
.assistant-msg.ai { margin-right: 10%; }
.assistant-msg.action, .assistant-msg.draft { border-style: dashed; }
.assistant-msg pre.draft { white-space: pre-wrap; font: inherit; margin: 0 0 8px; }
#assistant-plan { align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15px; }
