:root {
  --ink: #17211f;
  --muted: #60706c;
  --line: #dce5e1;
  --bg: #f5f8f6;
  --panel: #ffffff;
  --green: #1f8a70;
  --teal: #1a6f8f;
  --gold: #c98c28;
  --red: #c95050;
  --blue: #3b6fb6;
  --shadow: 0 18px 45px rgba(31, 52, 48, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(245, 248, 246, 0.92), rgba(245, 248, 246, 1)),
    repeating-linear-gradient(90deg, rgba(31, 138, 112, 0.06) 0 1px, transparent 1px 80px);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(220, 229, 225, 0.9);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  min-width: 240px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  overflow-x: auto;
}

.nav-toggle {
  display: none;
  width: 46px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #eef5f2;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.nav a:hover,
.nav a.active {
  color: var(--ink);
  background: #e9f2ef;
}

main {
  padding-bottom: 56px;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.data-status {
  position: sticky;
  top: 75px;
  z-index: 9;
  width: min(1180px, calc(100% - 32px));
  margin: 12px auto -36px;
  padding: 9px 12px;
  border: 1px solid #cfded8;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(31, 52, 48, 0.08);
  font-size: 0.86rem;
}

.data-status[hidden] {
  display: none;
}

.data-status[data-state="loaded"] {
  color: #0f513f;
  border-color: #b8dacd;
  background: #eff8f4;
}

.data-status[data-state="error"] {
  color: #7a3a16;
  border-color: #ead1ba;
  background: #fff5ea;
}

.section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 18px;
  scroll-margin-top: 82px;
}

.intro {
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.section-head {
  max-width: 100%;
}

.section-head.compact {
  margin-bottom: 20px;
}

.section-note {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  line-height: 1.04;
  letter-spacing: 0;
  max-width: 100%;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.metric-grid,
.idea-grid,
.quarter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.panel,
.idea-card,
.quarter-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
  min-height: 142px;
}

.municipality-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 14px;
  align-items: center;
}

.municipality-card > div {
  min-width: 0;
}

.bd-map-wrap {
  position: relative;
  width: 118px;
  height: 148px;
  justify-self: end;
  overflow: visible;
  background: transparent;
}

.bd-map-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.9;
}

.map-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 999px;
  background: #d63b3b;
  box-shadow: 0 0 0 3px rgba(214, 59, 59, 0.22), 0 4px 8px rgba(31, 52, 48, 0.2);
  transform: translate(-50%, -50%);
}

.map-pin::after {
  content: none;
}

.metric-card span,
.idea-card span,
.quarter-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin: 10px 0;
  font-size: 2.35rem;
}

.metric-card small {
  color: var(--muted);
  font-style: normal;
}

.compact-metrics {
  margin-bottom: 16px;
}

.compact-metrics .metric-card {
  min-height: 118px;
}

.compact-metrics .metric-card strong {
  font-size: 2rem;
}

.meter,
.mini-meter {
  display: block;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eeeb;
}

.meter i,
.mini-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--progress-color, var(--green));
  transition: width 0.25s ease, background-color 0.25s ease;
}

.overview-layout,
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.overview-layout {
  margin-top: 2px;
}

.overview-layout.single {
  grid-template-columns: 1fr;
}

.panel {
  padding: 22px;
}

.split > .section-head {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.split > .panel {
  height: 100%;
}

.wide-panel {
  grid-column: 1 / -1;
}

.text-panel p {
  max-width: 100%;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.tag-row span {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #153e35;
  background: #eef5f2;
  font-weight: 800;
  font-size: 0.86rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-head h2 {
  font-size: 1.1rem;
  margin: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.status-pill,
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef5f2;
  color: var(--green);
  padding: 7px 10px;
  font-weight: 700;
  font-size: 0.82rem;
}

.bar-list {
  display: grid;
  gap: 16px;
}

.bar-list div {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr 46px;
  align-items: center;
  gap: 12px;
}

.bar-list span {
  color: var(--ink);
  font-weight: 700;
}

.bar-list i,
.stacked-bars i {
  height: 13px;
  border-radius: 999px;
  background: #e9efec;
  overflow: hidden;
}

.bar-list b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-count {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip {
  cursor: pointer;
}

.chip.active {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.toolbar input {
  min-width: min(280px, 100%);
  margin-left: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.idea-card,
.quarter-card {
  padding: 20px;
  min-height: 180px;
}

.idea-card {
  border-top: 4px solid var(--green);
}

.idea-card:nth-child(2) {
  border-top-color: var(--teal);
}

.idea-card:nth-child(3) {
  border-top-color: var(--gold);
}

.idea-card:nth-child(4) {
  border-top-color: var(--blue);
}

.donut-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 248px;
}

.milestone-visuals {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
  gap: 28px;
  align-items: center;
}

.donut {
  width: 190px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 31%, var(--gold) 31% 38%, #d6ddd9 38% 100%);
  position: relative;
}

.donut::after {
  content: attr(data-total);
  position: absolute;
  inset: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  color: var(--ink);
  font-size: 2.3rem;
  font-weight: 800;
}

.legend {
  display: grid;
  gap: 12px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.legend b {
  color: var(--ink);
  margin-left: auto;
}

.line-chart-card {
  min-width: 0;
}

.chart-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.chart-title strong {
  font-size: 1rem;
}

.chart-title span {
  color: var(--green);
  font-weight: 900;
}

.line-chart {
  width: 100%;
  height: auto;
  overflow: visible;
}

.grid-lines line {
  stroke: #e4ebe8;
  stroke-width: 1;
}

.grid-lines text,
.line-labels text {
  fill: var(--muted);
  font-size: 11px;
}

.line-labels text {
  text-anchor: middle;
}

.progress-line {
  fill: none;
  stroke: var(--teal);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-points circle {
  fill: white;
  stroke: var(--green);
  stroke-width: 3;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.done {
  background: var(--green);
}

.doing {
  background: var(--gold);
}

.todo {
  background: #d6ddd9;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip.done {
  color: #0f513f;
  background: #dff2ea;
}

.status-chip.doing {
  color: #6b470d;
  background: #f8ebd2;
}

.status-chip.todo {
  color: #4f5d59;
  background: #edf2f0;
}

.table-panel {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

[data-table="workpackages"] td:first-child,
[data-table="milestones"] td:nth-child(2),
[data-table="deliverables"] td:nth-child(2) {
  min-width: 320px;
}

[data-table="ideas"] td:nth-child(1) {
  width: 160px;
}

[data-table="ideas"] td:nth-child(2) {
  width: 360px;
}

[data-table="ideas"] td:nth-child(3) {
  min-width: 520px;
  line-height: 1.6;
  color: #263936;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

td[data-value],
table:has(tbody[data-table="workpackages"]) th:nth-child(n+2),
table:has(tbody[data-table="milestones"]) th:nth-child(5),
table:has(tbody[data-table="expert-detail"]) th:nth-child(n+4) {
  text-align: right;
}

td small {
  display: block;
  max-width: 420px;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

.row-details summary,
.quarter-card summary {
  color: var(--green);
  cursor: pointer;
  font-weight: 800;
}

.row-details p {
  margin: 8px 0 0;
  max-width: 520px;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  white-space: nowrap;
}

th[data-sort] {
  cursor: pointer;
  user-select: none;
}

th[data-sort]::after {
  content: "↕";
  margin-left: 6px;
  color: #9aaaa5;
  font-size: 0.72rem;
}

th[data-direction="asc"]::after {
  content: "↑";
  color: var(--green);
}

th[data-direction="desc"]::after {
  content: "↓";
  color: var(--green);
}

.mini-meter {
  width: 130px;
}

.progress-cell {
  display: inline-grid;
  grid-template-columns: minmax(120px, 1fr) 48px;
  align-items: center;
  gap: 10px;
  min-width: 178px;
}

.progress-cell b {
  color: var(--ink);
  font-size: 0.86rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.timeline span {
  position: relative;
}

.timeline span::before {
  content: "";
  display: block;
  height: 10px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: #dbe5e0;
}

.timeline .current {
  color: var(--green);
  font-weight: 800;
}

.timeline .current::before {
  background: var(--green);
}

.timeline-lanes {
  display: grid;
  gap: 15px;
}

.timeline-lanes div {
  position: relative;
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  min-height: 32px;
}

.timeline-lanes div::after {
  content: "";
  grid-column: 2;
  height: 10px;
  border-radius: 999px;
  background: #ecf1ef;
}

.timeline-lanes i {
  position: absolute;
  top: 11px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.quarter-card.active {
  border-color: rgba(31, 138, 112, 0.45);
  background: #f5fbf8;
}

.quarter-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.quarter-card details {
  margin-top: 12px;
}

.qpr-panel {
  margin-top: 16px;
}

.qpr-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.qpr-columns h3 {
  font-size: 1rem;
}

.qpr-columns ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.stacked-bars {
  display: grid;
  gap: 22px;
  min-height: 236px;
  align-content: center;
}

.stacked-bars div {
  display: grid;
  grid-template-columns: 170px minmax(420px, 1fr) 390px;
  align-items: center;
  gap: 12px;
}

.stacked-bars span {
  white-space: nowrap;
}

.stacked-bars b {
  display: inline-block;
  height: 100%;
}

.actual {
  background: var(--green);
}

.planned {
  background: #6f4bb8;
}

.bar-values {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: normal;
  white-space: nowrap;
}

.panel-head .table-search {
  min-width: min(320px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.table-actions select,
.table-actions input {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.table-actions select {
  width: 150px;
}

.table-actions input {
  width: min(400px, 42vw);
}

@media (max-width: 920px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand {
    min-width: 0;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    width: 100%;
    gap: 8px;
    overflow: visible;
  }

  .nav:not(.open) {
    display: none;
  }

  .nav a {
    padding: 10px;
    text-align: center;
    font-size: 0.92rem;
  }

  .metric-grid,
  .idea-grid,
  .quarter-grid,
  .qpr-columns,
  .milestone-visuals,
  .overview-layout,
  .split {
    grid-template-columns: 1fr 1fr;
  }

  .overview-layout,
  .split {
    display: grid;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .nav a {
    white-space: normal;
  }

  .section {
    width: min(100% - 22px, 1180px);
    padding-top: 48px;
  }

  .intro {
    min-height: auto;
  }

  h1 {
    font-size: 2.25rem;
  }

  .metric-grid,
  .idea-grid,
  .quarter-grid,
  .overview-layout,
  .split,
  .overview-layout.single,
  .milestone-visuals {
    grid-template-columns: 1fr;
  }

  .bar-list div,
  .timeline-lanes div,
  .stacked-bars div {
    grid-template-columns: 1fr;
  }

  .donut-row {
    flex-direction: column;
  }

  .toolbar input {
    margin-left: 0;
    width: 100%;
  }

  .timeline {
    grid-template-columns: repeat(3, 1fr);
  }
}
