:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --surface: #fff;
  --ink: #222b27;
  --muted: #53615a;
  --line: #d9ded7;
  --green: #225647;
  --deep: #173e35;
  --mint: #e5efe8;
  --heading: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font: 16px/1.55 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow-wrap: anywhere; }
a { color: var(--green); text-underline-offset: .2em; }
a:hover { color: var(--deep); }
:focus-visible { outline: 3px solid #98702c; outline-offset: 3px; }
h1, h2, h3, p { margin: 0 0 .75rem; }
h1, h2, .row-title, .space-title { font-family: var(--heading); }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.06; letter-spacing: -.038em; font-weight: 600; }
h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); line-height: 1.2; font-weight: 600; letter-spacing: -.02em; }
h3 { font-size: 1.08rem; line-height: 1.3; }
p { max-width: 72ch; }
ul, ol { padding-inline-start: 1.4rem; }
.icon { flex: none; width: 1.25rem; height: 1.25rem; vertical-align: middle; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link:focus { position: absolute; z-index: 2; top: .5rem; left: .5rem; padding: .6rem 1rem; background: var(--surface); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  width: min(100%, 88rem); min-height: 4.5rem; margin: auto; padding: .65rem clamp(1rem, 3vw, 2.75rem);
  display: flex; align-items: center; justify-content: space-between; gap: .6rem 1rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 750; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; background: var(--deep); color: #f5ece0; border-radius: .55rem; font: 700 1.15rem var(--heading); }
.account { display: flex; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; font-size: .875rem; }
.account a { padding-block: .55rem; }
.layout { width: min(100%, 88rem); margin-inline: auto; }
.layout > main { width: min(100%, 72rem); margin-inline: auto; padding: clamp(1.25rem, 4vw, 3.5rem); min-width: 0; }
.with-sidebar { display: grid; grid-template-columns: minmax(15rem, 17rem) minmax(0, 1fr); }
.sidebar {
  min-height: calc(100vh - 4.5rem); min-width: 0; padding: 2.3rem 1rem 1rem clamp(1rem, 3vw, 2.75rem);
  border-right: 1px solid var(--line); background: #f0f1eb; --nav-surface: #f0f1eb;
}
.campaign-label { display: grid; gap: .25rem; padding: .25rem .7rem 1.15rem; }
.campaign-label span, .eyebrow { font-size: .75rem; letter-spacing: .105em; text-transform: uppercase; font-weight: 750; }
.campaign-label span { color: var(--muted); }
.campaign-label strong { font-family: var(--heading); font-size: 1.22rem; line-height: 1.25; }
.sidebar nav { display: grid; gap: .25rem; }
.nav-item { display: flex; min-height: 2.75rem; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: .5rem; color: var(--ink); text-decoration: none; font-size: .94rem; }
.nav-item .icon { color: var(--green); }
.nav-item:hover { background: var(--surface); }
.nav-item.selected { background: var(--deep); color: #fff; font-weight: 650; --nav-surface: var(--deep); }
.nav-item.selected .icon { color: #e3eee8; }
.staff-nav { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }

.campaign-hero, .cover {
  position: relative; isolation: isolate; overflow: hidden; background: var(--deep); color: #faf5e8;
  background-image: radial-gradient(ellipse at 88% 35%, #2b5d4f 0%, transparent 58%);
}
.campaign-hero { border-radius: 1rem; padding: clamp(1.65rem, 5vw, 3.7rem); margin-bottom: 2.4rem; }
.campaign-hero h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); max-width: 18ch; }
.campaign-hero p:last-of-type { margin-bottom: 0; color: #e1ebe5; }
.campaign-hero .eyebrow { color: #e4cd9e; margin-bottom: 1rem; }
.hero-mark { position: absolute; z-index: -1; right: 3%; top: 48%; transform: translateY(-50%); color: #52786b; opacity: .54; font: 600 clamp(7rem, 23vw, 16rem)/1 var(--heading); letter-spacing: -.1em; }
.space-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.space-card {
  display: flex; flex-direction: column; min-width: 0; gap: .65rem; padding: clamp(1rem, 2vw, 1.45rem);
  color: var(--ink); border: 1px solid var(--line); background: var(--surface); border-radius: .8rem;
  text-decoration: none; box-shadow: 0 2px 3px #173e3508;
}
.space-card:hover { border-color: var(--green); box-shadow: 0 5px 12px #173e3514; }
.space-icon { display: grid; place-items: center; width: 2.55rem; height: 2.55rem; border-radius: .6rem; color: var(--green); background: var(--mint); }
.notes .space-icon { color: #704613; background: #f3ead7; }
.journal .space-icon { color: #374e6c; background: #e8eef6; }
.space-title, .row-title { color: var(--ink); font-size: 1.27rem; font-weight: 700; line-height: 1.2; }
.space-description { color: var(--muted); font-size: .925rem; padding-bottom: .3rem; }
.space-footer { margin-top: auto; padding-top: .7rem; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .4rem; color: var(--green); font-size: .82rem; font-weight: 700; }
.foot-links { margin-top: 1.5rem; font-size: .9rem; }

.page-heading { margin-bottom: 1.65rem; }
.page-heading > p { color: var(--muted); margin: .75rem 0; }
.page-heading .badge { margin-top: .2rem; }
.panel + .panel { margin-top: 1.9rem; }
.section-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem .7rem; }
.section-heading h2 { margin-bottom: .45rem; }
.cards { list-style: none; display: grid; gap: .65rem; padding: 0; margin: .75rem 0 1.25rem; }
.cards > li, .journal-card, .note, .empty, .metrics > div {
  padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--surface);
}
.cards > li p:last-child, .row-main p:last-child, .journal-card p:last-child { margin-bottom: 0; }
.row, .actions, .metadata { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; }
.row { justify-content: space-between; }
.row-main { flex: 1 1 12rem; min-width: 0; }
.row-main .row-title { display: block; margin-bottom: .25rem; }
.metadata { color: var(--muted); font-size: .875rem; }
.actions { margin: .7rem 0; }
.actions > a:not(.button) { padding-block: .45rem; }
.actions > form { margin: 0; }
.badge { display: inline-block; color: #234e42; background: var(--mint); padding: .23rem .6rem; border-radius: 1rem; font: 650 .78rem/1.3 "Segoe UI", system-ui, sans-serif; }
.badge.pending { background: #f4ead7; color: #69440f; }
.badge.neutral { background: #e9ecee; color: #404c54; }
.readonly, .ok, .error { max-width: none; padding: .8rem 1rem; border: 1px solid; border-radius: .55rem; }
.readonly { color: #26463e; border-color: #cddfd6; background: #edf4ef; }
.ok { color: #20523b; border-color: #bad6c9; background: #e9f5ed; }
.error { color: #812d27; border-color: #e0c2bc; background: #fcf0ed; }
.empty { color: var(--muted); border-style: dashed; }
.note { white-space: pre-wrap; overflow-wrap: anywhere; margin: .85rem 0; line-height: 1.7; }
.markdown-preview { white-space: normal; overflow-x: auto; }
.markdown-preview pre { white-space: pre-wrap; }
.markdown-preview > :first-child { margin-block-start: 0; }
.markdown-preview > :last-child { margin-block-end: 0; }
.markdown-preview table { border-collapse: collapse; }
.markdown-preview :is(th, td) { border: 1px solid var(--line); padding: .25rem .5rem; }
.muted { color: var(--muted); font-size: .9rem; }
.back-link { font-size: .9rem; }
details { margin: .8rem 0; }
summary { color: var(--green); font-weight: 620; cursor: pointer; padding-block: .35rem; }
summary + * { margin-top: .45rem; }
.journal-card { margin: .75rem 0; padding: clamp(1rem, 3vw, 1.5rem); }
.journal-card h2 { margin: .6rem 0; }
.journal-card h2 a, .row-title a { color: var(--ink); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin: 1rem 0 1.7rem; }
.metrics dt { color: var(--muted); font-size: .88rem; }
.metrics dd { margin: 0; font: 650 1.65rem var(--heading); }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.75rem;
  padding: .52rem .9rem; border: 1px solid var(--green); border-radius: .45rem; background: var(--green);
  color: #fff; font: 650 .9rem/1.3 "Segoe UI", system-ui, sans-serif; text-align: center; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: var(--deep); color: #fff; }
button.secondary, .button.secondary { background: var(--surface); color: var(--green); border-color: #a8beb3; }
button.secondary:hover, .button.secondary:hover { background: var(--mint); }
.account button { min-height: 2.55rem; }
form.inline { display: inline; }
label { display: block; margin: .7rem 0; font-weight: 600; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  display: block; width: min(100%, 45rem); min-height: 2.75rem; margin-top: .3rem; padding: .5rem .6rem;
  border: 1px solid #aeb9b0; border-radius: .4rem; background: var(--surface); color: var(--ink); font: inherit;
}
textarea { resize: vertical; min-height: 5rem; }
input[type=checkbox], input[type=radio] { inline-size: 1.1rem; block-size: 1.1rem; accent-color: var(--green); vertical-align: -.15em; margin-inline: 0 .35rem; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: .6rem; margin: .8rem 0; padding: .5rem 1rem 1rem; }
legend { font-weight: 700; }
.confirm-form { max-width: 48rem; margin-block: 1rem; padding: .4rem 1rem 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); }
code { background: #edf0eb; padding: 0 .25rem; }
.campnav a { display: inline-block; margin: 0 1rem .5rem 0; }
.diff { border: 1px solid var(--line); background: var(--surface); padding: .55rem .8rem; border-radius: .55rem; font: .92em/1.5 ui-monospace, monospace; }
.diff div { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: .05rem; padding: .05rem .3rem; }
.d-add { background: #e4f6e8; border-left: 4px solid #1a7f37; }
.d-del { background: #fde7e7; border-left: 4px solid #b42318; }
.d-ctx { color: var(--muted); border-left: 4px solid transparent; }
.d-sep { color: var(--muted); text-align: center; }

.sign-in-layout > main { max-width: 65rem; padding-top: clamp(1.3rem, 7vw, 5.2rem); }
.sign-in { display: grid; grid-template-columns: 4fr 5fr; border: 1px solid var(--line); background: var(--surface); border-radius: 1rem; overflow: hidden; box-shadow: 0 12px 30px #173e350b; }
.cover { display: grid; align-content: center; justify-items: center; min-height: 27rem; padding: 2.25rem 1rem; }
.cover::before, .cover::after { content: ""; position: absolute; z-index: -1; inset: 1rem; border: 1px solid #c7b88c70; border-radius: .45rem; }
.cover::after { inset: 1.4rem; border-color: #c7b88c36; }
.cover-label { color: #ead4a8; font-size: .9rem; font-weight: 650; letter-spacing: .37em; text-indent: .37em; text-transform: uppercase; }
.cover-number { font: 500 clamp(6rem, 17vw, 11rem)/.95 var(--heading); letter-spacing: -.11em; padding-right: .11em; }
.sign-in-panel { align-self: center; padding: clamp(1.35rem, 5vw, 3.1rem); }
.sign-in-panel p { color: var(--muted); margin: .9rem 0 1.2rem; }
.sign-in-panel p.error { color: #812d27; }
.local-sign-in { border-top: 1px solid var(--line); margin-top: 1.4rem; padding-top: .7rem; font-size: .9rem; }
.steps li + li { margin-top: .55rem; }

@media (max-width: 66rem) {
  .space-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
  .with-sidebar { grid-template-columns: 14rem minmax(0, 1fr); }
}
@media (max-width: 48rem) {
  .with-sidebar { display: block; }
  .sidebar { min-height: 0; padding: .55rem 1rem .7rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .campaign-label { display: block; padding: .25rem .48rem .5rem; }
  .campaign-label > span { display: none; }
  .campaign-label strong { font-size: 1rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .nav-item { gap: .35rem; padding-inline: .48rem; font-size: .85rem; }
  .nav-item .icon { width: 1rem; height: 1rem; }
  .staff-nav { margin-top: .35rem; padding-top: .35rem; }
  .campaign-hero { margin-bottom: 1.5rem; }
}
@media (max-width: 36rem) {
  .sign-in { grid-template-columns: 1fr; }
  .cover { min-height: 9rem; padding: 1.5rem; }
  .cover::before { inset: .55rem; }
  .cover::after { inset: .8rem; }
  .cover-number { font-size: 4.6rem; }
  .sidebar nav:not(.staff-nav) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: 1fr; }
  .metrics > div { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
}
