/* Bright, friendly palette for an environmental NGO tool. */
:root {
  --bg: #f3faf4; --surface: #fff; --text: #1d3a2c; --muted: #5d7366; --line: #dcebe0;
  --accent: #1f9d55; --accent-dark: #157a41; --accent-ink: #fff;
  --sky: #0ea5c6; --sun: #ffb703; --coral: #f9734f; --lime: #8cc63f;
  --danger: #d6453d;
  --high: #1f9d55; --high-bg: #d6f3e0; --mid: #5f9e1f; --mid-bg: #e8f6cf;
  --low: #b77900; --low-bg: #fff0c7; --start: #d4542f; --start-bg: #ffe1d7;
  --none: #6f8279; --none-bg: #edf2ef;
  --radius: 16px; --shadow: 0 2px 10px rgb(31 157 85 / 8%), 0 1px 2px rgb(0 0 0 / 4%);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); line-height: 1.55;
  background: radial-gradient(1200px 400px at 10% -10%, #e2f6ff 0%, transparent 60%),
              radial-gradient(900px 380px at 100% 0%, #fff4d6 0%, transparent 55%), var(--bg);
  background-attachment: fixed; min-height: 100vh; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: .2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 .7rem; }
h3 { font-size: 1rem; margin: .8rem 0 .3rem; }
code, .code { font-family: ui-monospace, "Cascadia Code", monospace; font-size: .88em; }
.code { color: var(--sky); font-weight: 700; margin-right: .3rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.lead { font-size: 1.1rem; }

/* header */
.topbar { display: flex; flex-wrap: wrap; gap: .75rem 1.4rem; align-items: center;
  padding: .7rem 1.2rem; background: rgb(255 255 255 / 92%); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--line); }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--lime), var(--sun), var(--coral), var(--sky)); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--accent-dark); font-size: 1.05rem; }
.brand-icon { font-size: 1.35rem; line-height: 1; }
.mainnav { display: flex; gap: .3rem; flex-wrap: wrap; }
.mainnav a { color: var(--text); padding: .3rem .75rem; border-radius: 999px; font-weight: 500; }
.mainnav a:hover { background: var(--high-bg); text-decoration: none; }
.usermenu { display: flex; gap: .6rem; align-items: center; margin-left: auto; font-size: .9rem; }
.usermenu form { margin: 0; }
.search { position: relative; flex: 1 1 240px; max-width: 420px; }
.search input { width: 100%; border-radius: 999px; padding-left: 1rem; background: #f6fbf7; }
.search-dropdown { position: absolute; top: 115%; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(29 58 44 / 18%);
  max-height: 70vh; overflow: auto; }
.search-dropdown:empty { display: none; }
.results { padding: .6rem .9rem; }
.results h4 { margin: .6rem 0 .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.results ul { list-style: none; margin: 0; padding: 0; }
.results li { padding: .2rem 0; }

/* layout */
.container { max-width: 1280px; margin: 0 auto; padding: 1.2rem; }
.pagehead { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { margin: 0; font-size: .85rem; }
.card { display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: var(--shadow); color: inherit; }
a.card { transition: transform .15s, box-shadow .15s; }
a.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 24px rgb(31 157 85 / 15%); }
.card.narrow { max-width: 560px; margin: 1.5rem auto; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); margin-top: 1rem; }
.canvas-card { border-top: 5px solid var(--accent); }
.cards .canvas-card:nth-child(2n) { border-top-color: var(--sky); }
.cards .canvas-card:nth-child(3n) { border-top-color: var(--sun); }
.canvas-card h2 { margin: .2rem 0 .8rem; font-size: 1.05rem; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.block { margin-top: 1.8rem; }
.blockhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.notice { background: var(--low-bg); padding: .7rem 1.1rem; border-radius: var(--radius); border: 1px solid #ffe08a; }

/* progress */
.progress { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.progress .bar { flex: 0 0 170px; height: 10px; background: var(--none-bg); border-radius: 999px; overflow: hidden; }
.progress .fill { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--accent)); }
.progress .pct { font-weight: 800; min-width: 3ch; color: var(--accent-dark); }

/* section board */
.board { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: 1rem; margin-top: .6rem; }
@media (max-width: 800px) { .board { grid-template-columns: 1fr; } }
.column { display: grid; gap: .8rem; align-content: start; }
.goal { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--accent);
  border-radius: 12px; padding: .85rem 1rem; box-shadow: var(--shadow); }
.goal header { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.goal footer { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .4rem; }
.goal footer form { margin: 0; }
.projects { margin: .4rem 0; padding-left: 1.1rem; }
.hidden-goals { background: repeating-linear-gradient(135deg, #f4f7f5, #f4f7f5 10px, #eef3f0 10px, #eef3f0 20px);
  border-radius: var(--radius); padding: .9rem; border: 1px dashed #cfdcd4; }
.hidden-goals h3 { margin-top: 0; color: var(--muted); }
.muted-goal { opacity: .6; filter: grayscale(1); border-left-color: var(--none); box-shadow: none; }
.muted-goal:hover { opacity: 1; filter: none; }
.muted-goal form { margin-top: .4rem; }

/* badges & pills */
.badge, .pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: .1rem .55rem;
  border-radius: 999px; background: var(--none-bg); color: var(--none); white-space: nowrap; }
.badge.state-achieved { background: var(--high-bg); color: var(--high); }
.badge.state-in_progress { background: var(--low-bg); color: var(--low); }
.badge.state-open { background: var(--start-bg); color: var(--start); }
.badge.state-no_target { background: #e4f3f9; color: #317e96; }
.badge.state-not_tracked { background: transparent; border: 1px dashed #c4d1ca; font-weight: 500; }
.status-completed, .proposal-accepted { background: var(--high-bg); color: var(--high); }
.status-in_progress, .proposal-proposal { background: var(--low-bg); color: var(--low); }
.status-planned { background: #e4f3f9; color: #317e96; }
.status-cancelled, .proposal-refused { background: var(--start-bg); color: var(--start); }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.table, .heatmap { width: 100%; border-collapse: collapse; background: var(--surface); }
.table { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td, .heatmap th, .heatmap td { border-bottom: 1px solid var(--line); padding: .5rem .65rem; text-align: left; vertical-align: top; }
.table thead th, .heatmap thead th { background: #f0f8f2; font-size: .85rem; }
.heatmap td { text-align: center; }
.heatmap td.state-not_tracked { opacity: .5; }
.heatmap tbody tr:hover { background: #f7fcf8; }
tr.inactive { opacity: .5; }
.diff .old { background: var(--start-bg); } .diff .new { background: var(--high-bg); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs a { padding: .3rem .8rem; border-radius: 999px; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.tabs a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.sectionnav { display: flex; gap: .4rem .9rem; flex-wrap: wrap; margin-top: 2rem; }
.requests { list-style: none; padding: 0; } .requests li { border-bottom: 1px solid var(--line); padding: .6rem 0; }

/* forms & buttons */
input, select, textarea { font: inherit; color: inherit; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; padding: .45rem .65rem; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(31 157 85 / 18%); }
textarea { width: 100%; }
.field { display: grid; gap: .25rem; margin-bottom: .9rem; }
.field input:not([type=checkbox]):not([type=radio]), .field select { width: 100%; }
.field label { font-weight: 600; font-size: .9rem; }
.errors, .errorlist { color: var(--danger); font-size: .9rem; }
.errorlist { list-style: none; padding: 0; margin: 0; }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); transition: all .15s; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-dark); }
.btn.primary { background: linear-gradient(135deg, #27b062, var(--accent)); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 3px 10px rgb(31 157 85 / 30%); }
.btn.primary:hover { filter: brightness(1.05); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f2b8b3; }
.btn.small { font-size: .8rem; padding: .15rem .6rem; }
button.link { background: none; border: 0; color: var(--accent-dark); cursor: pointer; padding: 0; font: inherit; }
button.link.small { font-size: .85rem; }
form.inline { display: inline; }
.radio { margin-right: 1rem; }
.vote { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.messages { list-style: none; padding: 0; }
.msg { padding: .7rem 1.1rem; border-radius: var(--radius); margin-bottom: .5rem; background: var(--high-bg); border: 1px solid #b6e6c7; }
.msg-error { background: var(--start-bg); border-color: #f7c0ae; }
.qr { background: #fff; padding: 8px; border-radius: 10px; }

/* Switzerland map */
.chmap { position: relative; margin-top: 1rem; padding: 1rem 1rem .6rem;
  background: linear-gradient(180deg, #f2fbff, #fff 70%); }
.chmap-svg { display: block; width: 100%; height: auto; }
.canton { stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; transition: fill .2s; }
.canton.tone-high { fill: #bfeccf; } .canton.tone-mid { fill: #e0f2c0; }
.canton.tone-low { fill: #ffecb8; } .canton.tone-start { fill: #ffe3d8; }
.canton.tone-none, .canton.tone-empty { fill: #e7eeea; }
.lakes { fill: #b7e3f5; }
.marker { cursor: pointer; outline: none; }
.marker image, .marker text { transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.marker image { filter: drop-shadow(0 2px 2px rgb(0 0 0 / 28%)); }
.marker:hover image, .marker:focus image { transform: scale(1.18); }
.marker:focus-visible image { filter: drop-shadow(0 0 3px var(--sky)); }
.marker .pct { font-size: 16px; font-weight: 800; text-anchor: middle; dominant-baseline: middle;
  stroke: #fff; stroke-width: 4px; paint-order: stroke; stroke-linejoin: round; }
.marker.tone-high .pct { fill: var(--high); } .marker.tone-mid .pct { fill: var(--mid); }
.marker.tone-low .pct { fill: var(--low); } .marker.tone-start .pct { fill: var(--start); }
.marker.tone-none .pct { fill: var(--none); }
.maptip { position: absolute; z-index: 5; width: 330px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: .7rem .85rem; box-shadow: 0 12px 30px rgb(29 58 44 / 20%); font-size: .85rem; pointer-events: none; }
.maptip-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .3rem; }
.maptip-pct { margin-left: auto; font-weight: 800; font-size: 1.05rem; }
.maptip-pct.tone-high { color: var(--high); } .maptip-pct.tone-mid { color: var(--mid); }
.maptip-pct.tone-low { color: var(--low); } .maptip-pct.tone-start { color: var(--start); }
.maptip-canvas { margin-top: .45rem; font-weight: 600; display: flex; gap: .3rem; }
.maptip-canvas .muted { margin-left: auto; }
.maptip ul { list-style: none; margin: .2rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem; }
.maptip li { display: flex; align-items: center; gap: .35rem; }
.maptip .otitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.maplegend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .4rem; }
.maplegend .attribution { margin-left: auto; font-size: .75rem; }
.dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
.dot.tone-high { background: var(--high); } .dot.tone-mid { background: var(--lime); }
.dot.tone-low { background: var(--sun); } .dot.tone-start { background: var(--coral); }
.dot.tone-none { background: #c9d5ce; }
.w0{width:0%}
.w1{width:1%}
.w2{width:2%}
.w3{width:3%}
.w4{width:4%}
.w5{width:5%}
.w6{width:6%}
.w7{width:7%}
.w8{width:8%}
.w9{width:9%}
.w10{width:10%}
.w11{width:11%}
.w12{width:12%}
.w13{width:13%}
.w14{width:14%}
.w15{width:15%}
.w16{width:16%}
.w17{width:17%}
.w18{width:18%}
.w19{width:19%}
.w20{width:20%}
.w21{width:21%}
.w22{width:22%}
.w23{width:23%}
.w24{width:24%}
.w25{width:25%}
.w26{width:26%}
.w27{width:27%}
.w28{width:28%}
.w29{width:29%}
.w30{width:30%}
.w31{width:31%}
.w32{width:32%}
.w33{width:33%}
.w34{width:34%}
.w35{width:35%}
.w36{width:36%}
.w37{width:37%}
.w38{width:38%}
.w39{width:39%}
.w40{width:40%}
.w41{width:41%}
.w42{width:42%}
.w43{width:43%}
.w44{width:44%}
.w45{width:45%}
.w46{width:46%}
.w47{width:47%}
.w48{width:48%}
.w49{width:49%}
.w50{width:50%}
.w51{width:51%}
.w52{width:52%}
.w53{width:53%}
.w54{width:54%}
.w55{width:55%}
.w56{width:56%}
.w57{width:57%}
.w58{width:58%}
.w59{width:59%}
.w60{width:60%}
.w61{width:61%}
.w62{width:62%}
.w63{width:63%}
.w64{width:64%}
.w65{width:65%}
.w66{width:66%}
.w67{width:67%}
.w68{width:68%}
.w69{width:69%}
.w70{width:70%}
.w71{width:71%}
.w72{width:72%}
.w73{width:73%}
.w74{width:74%}
.w75{width:75%}
.w76{width:76%}
.w77{width:77%}
.w78{width:78%}
.w79{width:79%}
.w80{width:80%}
.w81{width:81%}
.w82{width:82%}
.w83{width:83%}
.w84{width:84%}
.w85{width:85%}
.w86{width:86%}
.w87{width:87%}
.w88{width:88%}
.w89{width:89%}
.w90{width:90%}
.w91{width:91%}
.w92{width:92%}
.w93{width:93%}
.w94{width:94%}
.w95{width:95%}
.w96{width:96%}
.w97{width:97%}
.w98{width:98%}
.w99{width:99%}
.w100{width:100%}

/* notifications & inbox */
.nav-badge { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px;
  background: var(--coral); color: #fff; font-size: .72rem; font-weight: 800; line-height: 1.3rem;
  text-align: center; vertical-align: 1px; box-shadow: 0 0 0 2px #fff; }
.nav-badge:empty { display: none; }
.msg-info { background: #e4f3f9; border-color: #b9e0ef; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .2rem 0 1rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .85rem; cursor: pointer;
  padding: .25rem .7rem .25rem .45rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--high-bg); }
.chip[aria-pressed="false"] { opacity: .55; text-decoration: line-through; }
.chip-badge { background: var(--coral); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 800; padding: 0 .4rem; }
.chip-actions { margin-left: auto; color: var(--muted); }
.chip-actions .link { font-size: .85rem; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: .8rem; overflow: hidden; }
.group[data-unread]:not([data-unread="0"]) { border-left: 5px solid var(--coral); }
.group-head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; cursor: pointer;
  list-style: none; background: linear-gradient(90deg, #f6fbf7, #fff); }
.group-head::-webkit-details-marker { display: none; }
.group-head::after { content: "▸"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.group[open] > .group-head::after { transform: rotate(90deg); }
.group-head img { filter: drop-shadow(0 1px 1px rgb(0 0 0 / 25%)); }
.group-unread { background: var(--start-bg); color: var(--start); font-weight: 700; font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; }
.group-read { margin: 0; }
.messages-list { border-top: 1px solid var(--line); }
.msgitem { border-bottom: 1px solid var(--line); }
.msgitem:last-child { border-bottom: 0; }
.msgitem > summary { display: grid; grid-template-columns: .7rem 6.5rem 3.5rem minmax(0, 1fr) auto; gap: .6rem;
  align-items: center; padding: .45rem 1rem; cursor: pointer; list-style: none; font-size: .9rem; }
.msgitem > summary::-webkit-details-marker { display: none; }
.msgitem > summary:hover { background: #f7fcf8; }
.msgitem:has(.unread-dot) > summary { font-weight: 700; background: #fff8f5; }
.unread-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--coral); grid-column: 1; }
.msg-date { grid-column: 2; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgitem[open] .msg-snippet { white-space: normal; }
.msg-body { padding: .2rem 1rem .9rem 2.2rem; background: #fbfdfb; }
@media (max-width: 700px) {
  .msgitem > summary { grid-template-columns: .7rem 1fr; }
  .msg-date, .msgitem .code, .msg-snippet, .msg-from { grid-column: 2; }
}

/* goal tracking switch (section lead) */
.goal-tools { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.goal-tools form { margin: 0; }
.track-switch { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-size: .78rem; font-weight: 700;
  cursor: pointer; padding: .15rem .6rem .15rem .2rem; border-radius: 999px; white-space: nowrap;
  border: 1.5px solid #c9d6ce; background: #eef3f0; color: var(--muted); transition: all .15s; }
.track-switch .knob { position: relative; width: 1.9rem; height: 1.05rem; border-radius: 999px; background: #c3cfc8; transition: background .15s; }
.track-switch .knob::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: .75rem; height: .75rem;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 25%); transition: left .15s; }
.track-switch.on { border-color: #9fdcb5; background: var(--high-bg); color: var(--high); }
.track-switch.on .knob { background: var(--accent); }
.track-switch.on .knob::after { left: 1rem; }
button.track-switch:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(31 157 85 / 15%); }
button.track-switch:not(.on):hover { color: var(--accent-dark); }
.track-switch.demo { cursor: default; vertical-align: middle; }
.hint { background: #fffbea; border: 1px solid #ffe08a; border-radius: var(--radius); padding: .7rem 1rem; font-size: .9rem; }
.muted-goal .track-switch { margin-top: .5rem; }
.muted-goal:has(.track-switch) { filter: none; opacity: .85; }
