:root {
  --green-950: #052f20;
  --green-900: #073d2a;
  --green-800: #07563a;
  --green-700: #0b7650;
  --green-100: #e8f3ed;
  --green-50: #f3f8f5;
  --gold-500: #d9a83e;
  --gold-100: #fbf3df;
  --ink-950: #101816;
  --ink-700: #3e4b47;
  --ink-500: #6f7b77;
  --line: #dfe7e2;
  --paper: #ffffff;
  --canvas: #f2f6f3;
  --issue: #b44537;
  --issue-soft: #fbebe8;
  --radius: 8px;
  --shadow: 0 16px 48px rgba(5, 47, 32, 0.08);
  --max: 1260px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-950);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button { cursor: pointer; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - var(--max)) / 2));
  background: rgba(5, 47, 32, 0.96);
  color: #fff;
  box-shadow: 0 10px 32px rgba(5, 47, 32, 0.16);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 132px;
  height: auto;
  filter: brightness(0) invert(1);
}

.brand span {
  display: grid;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,.25);
}

.brand strong { font-size: 17px; }
.brand small { color: rgba(255,255,255,.55); font: 700 10px/1.4 ui-monospace, monospace; letter-spacing: .12em; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--radius);
  background: var(--gold-500);
  color: var(--green-950);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.admin-link:hover { background: #e5b84f; }
.admin-link i { font-size: 17px; }

.environment-badge,
.eyebrow,
.section-code,
.phase-code,
.summary-heading > span,
.timeline-toolbar > div > span {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-weight: 800;
  letter-spacing: .08em;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  color: rgba(255,255,255,.8);
  font-size: 12px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 19px;
}

.icon-button:hover { background: rgba(255,255,255,.16); }

.intro-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 42px;
  align-items: end;
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
  padding: 64px 0 50px;
  border-bottom: 1px solid #cdd8d1;
}

.intro-copy { max-width: 760px; }

.eyebrow {
  display: inline-flex;
  margin-bottom: 16px;
  color: var(--green-700);
  font-size: 12px;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1.08;
  letter-spacing: 0;
}

.intro-copy p {
  max-width: 690px;
  margin: 0;
  color: var(--ink-700);
  font-size: 17px;
}

.project-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.project-facts div {
  display: grid;
  gap: 4px;
  min-width: 130px;
  padding: 16px 18px;
  background: rgba(255,255,255,.72);
}

.project-facts span { color: var(--ink-500); font-size: 12px; }
.project-facts strong { color: var(--green-900); font-size: 17px; white-space: nowrap; }

.workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 36px;
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.summary-panel {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.summary-heading span,
.timeline-toolbar > div > span,
.section-code,
.phase-code { color: var(--gold-500); font-size: 10px; }

.summary-heading h2,
.timeline-toolbar h2 { margin: 4px 0 0; font-size: 24px; }

.progress-orbit {
  position: relative;
  display: grid;
  width: 172px;
  height: 172px;
  margin: 26px auto;
  place-items: center;
}

.progress-orbit svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.progress-orbit circle { fill: none; stroke-width: 8; }
.orbit-track { stroke: var(--green-100); }
.orbit-value { stroke: var(--gold-500); stroke-linecap: round; stroke-dasharray: 320.44; stroke-dashoffset: 320.44; transition: stroke-dashoffset .35s ease; }
.progress-orbit > div { display: grid; text-align: center; }
.progress-orbit strong { color: var(--green-900); font: 800 34px/1 ui-monospace, monospace; }
.progress-orbit span { margin-top: 8px; color: var(--ink-500); font-size: 12px; }

.status-counts { display: grid; gap: 8px; }
.status-counts div {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  min-height: 42px;
  padding: 0 11px;
  border-radius: 6px;
  background: var(--green-50);
  color: var(--ink-700);
}
.status-counts i { color: var(--green-700); font-size: 17px; }
.status-counts strong { color: var(--green-900); font: 800 17px/1 ui-monospace, monospace; }

.summary-divider { height: 1px; margin: 22px 0; background: var(--line); }
.filter-group > span { color: var(--ink-500); font-size: 12px; }
.filter-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 9px; padding: 4px; border-radius: var(--radius); background: var(--green-50); }
.filter-tabs button { min-height: 34px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-700); font-size: 12px; font-weight: 700; }
.filter-tabs button.active { background: var(--green-900); color: #fff; box-shadow: 0 4px 12px rgba(5,47,32,.16); }
.record-meta { margin-top: 20px; }
.record-meta > div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.record-meta > div span { color: var(--ink-500); }
.record-meta p { display: flex; gap: 7px; margin: 14px 0 0; color: var(--ink-500); font-size: 11px; line-height: 1.6; }

.timeline-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: var(--radius);
  font-weight: 800;
}
.secondary-button { border: 1px solid #cfdad3; background: transparent; color: var(--green-800); }
.secondary-button:hover { background: var(--green-100); }

.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 25px; bottom: 24px; left: 25px; width: 1px; background: linear-gradient(var(--gold-500), #aac7b5 82%, transparent); }

.phase {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 20px;
  padding-bottom: 28px;
}
.phase[hidden] { display: none; }

.timeline-node {
  position: relative;
  z-index: 2;
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--gold-500);
  border-radius: 50%;
  background: var(--canvas);
  color: var(--green-900);
  font: 900 12px/1 ui-monospace, monospace;
  box-shadow: 0 0 0 7px var(--canvas);
}
.phase.complete .timeline-node { border-color: var(--green-700); background: var(--green-700); color: #fff; }
.phase.has-issue .timeline-node { border-color: var(--issue); color: var(--issue); }

.phase-body {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.phase-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: center;
  min-height: 116px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #fff 0%, #fff 70%, var(--green-50) 100%);
}
.phase-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-800); font-size: 22px; }
.phase-header h3 { margin: 3px 0 3px; font-size: 22px; }
.phase-header p { margin: 0; color: var(--ink-500); font-size: 13px; }
.phase-progress { display: grid; min-width: 66px; text-align: right; }
.phase-progress strong { color: var(--green-900); font: 800 20px/1 ui-monospace, monospace; }
.phase-progress span { margin-top: 6px; color: var(--ink-500); font-size: 10px; }

.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 17px 24px;
  border-bottom: 1px solid var(--line);
  transition: background .18s ease;
}
.check-row:last-child { border-bottom: 0; }
.check-row[data-status="passed"] { background: rgba(232,243,237,.42); }
.check-row[data-status="issue"] { background: rgba(251,235,232,.48); }
.check-row[hidden] { display: none; }

.check-copy { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: start; }
.check-index { padding-top: 3px; color: var(--gold-500); font: 800 10px/1.5 ui-monospace, monospace; }
.check-copy h4 { margin: 0 0 2px; font-size: 15px; }
.check-copy p { margin: 0; color: var(--ink-500); font-size: 12px; }
.check-actions { display: flex; align-items: center; gap: 7px; }
.status-switch { display: grid; grid-template-columns: repeat(3, 38px); gap: 3px; padding: 3px; border-radius: 7px; background: var(--green-50); }
.status-switch button,
.note-toggle { display: grid; width: 38px; height: 34px; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--ink-500); }
.status-switch button span { display: none; }
.status-switch button:hover,
.note-toggle:hover { background: var(--green-100); color: var(--green-800); }
.status-switch [data-status="pending"].active { background: var(--gold-100); color: #9b6a05; }
.status-switch [data-status="passed"].active { background: var(--green-700); color: #fff; }
.status-switch [data-status="issue"].active { background: var(--issue); color: #fff; }
.note-toggle { border: 1px solid var(--line); }
.check-note { grid-column: 1 / -1; padding: 4px 0 2px 40px; }
.check-note label { display: grid; gap: 7px; }
.check-note span { color: var(--ink-500); font-size: 11px; }

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
  color: var(--ink-950);
  outline: none;
}
textarea { padding: 10px 12px; resize: vertical; }
input, select { height: 44px; padding: 0 12px; }
textarea:focus, input:focus, select:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(11,118,80,.1); }

.signoff-section {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 20px;
  margin-top: 4px;
}
.signoff-mark { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 50%; background: var(--green-900); color: #fff; font-size: 22px; box-shadow: 0 0 0 7px var(--canvas); }
.signoff-content { padding: 28px; border-radius: var(--radius); background: var(--green-950); color: #fff; box-shadow: 0 20px 56px rgba(5,47,32,.2); }
.signoff-content h2 { margin: 5px 0 8px; font-size: 28px; }
.signoff-lead { color: rgba(255,255,255,.68); font-size: 14px; }
.signoff-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 22px; }
.signoff-grid label, .signoff-note { display: grid; gap: 7px; }
.signoff-grid label > span, .signoff-note > span { color: rgba(255,255,255,.62); font-size: 11px; }
.signoff-content input, .signoff-content select, .signoff-content textarea { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.08); color: #fff; color-scheme: dark; }
.signoff-content input::placeholder, .signoff-content textarea::placeholder { color: rgba(255,255,255,.38); }
.signoff-note { margin-top: 14px; }
.signoff-actions { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.primary-button { border: 0; background: var(--gold-500); color: var(--green-950); }
.primary-button:hover { background: #e5b84f; }
.signoff-actions > span { color: rgba(255,255,255,.5); font-size: 11px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px max(24px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid #cdd8d1;
  color: var(--ink-500);
  font-size: 12px;
}

@media (max-width: 920px) {
  .intro-band { grid-template-columns: 1fr; }
  .project-facts { width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .summary-panel { position: static; display: grid; grid-template-columns: 1fr 172px; gap: 18px; }
  .status-counts, .summary-divider, .filter-group, .record-meta { grid-column: 1 / -1; }
  .progress-orbit { grid-column: 2; grid-row: 1; margin: -10px 0 0 auto; transform: scale(.8); transform-origin: top right; }
}

@media (max-width: 640px) {
  .topbar { min-height: 62px; padding: 0 15px; }
  .brand img { width: 100px; }
  .brand span { display: none; }
  .environment-badge { display: none; }
  .admin-link { width: 38px; padding: 0; justify-content: center; }
  .admin-link span { display: none; }
  .intro-band, .workspace { width: calc(100% - 28px); }
  .intro-band { gap: 24px; padding: 40px 0 30px; }
  h1 { max-width: 340px; font-size: 34px; }
  .intro-copy p { font-size: 14px; }
  .project-facts { grid-template-columns: 1fr; }
  .project-facts div { grid-template-columns: 1fr auto; min-width: 0; }
  .workspace { gap: 30px; padding-top: 26px; }
  .summary-panel { display: block; padding: 20px; }
  .progress-orbit { margin: 20px auto; transform: none; }
  .timeline-toolbar { align-items: center; }
  .timeline-toolbar h2 { font-size: 21px; }
  .secondary-button { width: 40px; padding: 0; }
  .secondary-button i { font-size: 18px; }
  .secondary-button:not(.primary-button) { font-size: 0; }
  .timeline::before { left: 16px; }
  .phase, .signoff-section { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .timeline-node, .signoff-mark { width: 34px; height: 34px; font-size: 9px; box-shadow: 0 0 0 5px var(--canvas); }
  .signoff-mark { font-size: 16px; }
  .phase-header { grid-template-columns: 38px 1fr; min-height: 0; padding: 18px 16px; }
  .phase-icon { width: 38px; height: 38px; font-size: 18px; }
  .phase-header h3 { font-size: 18px; }
  .phase-progress { grid-column: 2; display: flex; gap: 6px; min-width: 0; text-align: left; }
  .phase-progress span { margin-top: 1px; }
  .check-row { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .check-actions { justify-content: flex-end; }
  .status-switch { grid-template-columns: repeat(3, minmax(64px, 1fr)); width: 100%; }
  .status-switch button { display: flex; width: auto; gap: 5px; }
  .status-switch button span { display: inline; font-size: 11px; }
  .check-note { padding-left: 0; }
  .signoff-content { padding: 22px 18px; }
  .signoff-grid { grid-template-columns: 1fr; }
  .signoff-actions { align-items: stretch; flex-direction: column; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media print {
  :root { --canvas: #fff; }
  .topbar, .summary-panel, .timeline-toolbar .secondary-button, .check-actions, footer { display: none !important; }
  .intro-band { padding: 24px 0; }
  .workspace { display: block; width: 100%; padding: 24px 0; }
  .timeline-column { width: 100%; }
  .phase { break-inside: avoid; grid-template-columns: 38px 1fr; gap: 12px; padding-bottom: 16px; }
  .timeline::before { left: 18px; }
  .timeline-node, .signoff-mark { width: 38px; height: 38px; box-shadow: none; }
  .phase-body { box-shadow: none; }
  .phase-header { min-height: 82px; padding: 14px 18px; }
  .check-row { padding: 10px 18px; }
  .check-note[hidden] { display: none; }
  .signoff-section { grid-template-columns: 38px 1fr; gap: 12px; break-inside: avoid; }
  .signoff-content { box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .signoff-actions { display: none; }
}
