:root {
  --bg: #e9eeea;
  --bg-deep: #dfe6e1;
  --ink: #1c2a24;
  --muted: #5f7168;
  --line: #c5d0c9;
  --paper: #f7faf7;
  --accent: #245844;
  --accent-soft: #d5e4db;
  --warn: #8a5a22;
  --danger: #9b3b3b;
  --ok: #2f6b4a;
  --radius: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "DM Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  background:
    linear-gradient(180deg, rgba(233,238,234,.92), rgba(223,230,225,.96)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 47px,
      rgba(36, 88, 68, 0.035) 47px,
      rgba(36, 88, 68, 0.035) 48px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 47px,
      rgba(36, 88, 68, 0.035) 47px,
      rgba(36, 88, 68, 0.035) 48px
    ),
    var(--bg);
}
body { padding-bottom: calc(28px + var(--safe-bottom)); }

#fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.7;
}
#app { position: relative; z-index: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(247, 250, 247, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand {
  font-family: "Source Serif 4", "Noto Serif SC", serif;
  font-weight: 700;
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  letter-spacing: 0.02em;
  cursor: pointer;
  color: var(--ink);
}
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 4px 9px;
  border-radius: 6px;
}

main {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.hero {
  padding: 28px 2px 18px;
  animation: in 0.55s ease both;
}
.hero h1 {
  margin: 0 0 10px;
  font-family: "Source Serif 4", "Noto Serif SC", serif;
  font-size: clamp(1.7rem, 5vw, 2.35rem);
  line-height: 1.2;
  font-weight: 700;
  color: var(--ink);
  max-width: 14ch;
}
.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 36rem;
  font-size: 0.98rem;
}

@keyframes in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  animation: in 0.6s ease both;
}

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
textarea { min-height: 110px; resize: vertical; }

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #f4faf6;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, .btn:hover { filter: brightness(1.05); }
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button.ghost, .btn.ghost {
  background: var(--accent-soft);
  color: var(--accent);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}
.check-row input { width: auto; }

.doc-list { display: grid; gap: 12px; }
.doc-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  border-radius: 0;
  transition: opacity .2s ease;
}
.doc-card:hover { opacity: 0.84; }
.doc-card:last-child { border-bottom: 0; padding-bottom: 0; }
@media (max-width: 640px) { .doc-card { grid-template-columns: 1fr; } }

.doc-cover {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-deep);
  border: 1px solid var(--line);
}
.doc-cover.ph {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  background: var(--bg-deep);
}
.doc-card h3 {
  margin: 0 0 6px;
  font-family: "Source Serif 4", "Noto Serif SC", serif;
  font-size: 1.08rem;
  line-height: 1.35;
  font-weight: 650;
}
.meta { color: var(--muted); font-size: 13px; line-height: 1.5; }

.section {
  scroll-margin-top: 72px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.section:last-child { border-bottom: 0; }
.section h2 {
  margin: 0 0 10px;
  font-family: "Source Serif 4", "Noto Serif SC", serif;
  font-size: 1.12rem;
}
.section .body {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 15px;
}

.toolbar {
  position: sticky;
  top: 57px;
  z-index: 15;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 0;
  background: linear-gradient(180deg, rgba(247,250,247,.96), rgba(247,250,247,.8));
}

.comment {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  display: grid;
  gap: 8px;
}
.comment:first-child { border-top: 0; padding-top: 0; }
.comment .who { font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #f0e6d6;
  color: var(--warn);
}
.badge.ok { background: #dfece4; color: var(--ok); }

.diff { display: grid; gap: 8px; }
@media (min-width: 760px) { .diff.cols { grid-template-columns: 1fr 1fr; } }
.diff .box {
  border-radius: 6px;
  padding: 10px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.55;
  min-height: 64px;
  border: 1px solid var(--line);
}
.diff .before { background: #f8eeee; }
.diff .after { background: #eef6f1; }

.error { color: var(--danger); font-size: 14px; }
.okmsg { color: var(--ok); font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  white-space: nowrap;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 10px;
  font-weight: 500;
}
.tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  background: transparent;
}

.progress-wrap { display: grid; gap: 8px; margin-top: 10px; }
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-deep);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.milestone {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.milestone:last-child { border-bottom: 0; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: #b7c4bc;
}
.dot.done { background: var(--ok); }
.dot.doing { background: var(--warn); }

.intro-grid { display: grid; gap: 12px; }
.intro-grid .kv {
  display: grid;
  gap: 4px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}
.intro-grid .kv:last-child { border-bottom: 0; padding-bottom: 0; }
.intro-grid .k { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.intro-grid .v { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.status-select { min-width: 110px; padding: 8px 10px !important; }
.notify-box {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #f3f7f4;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.gallery figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg-deep);
}
.gallery figcaption {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.data-table-wrap { margin: 0 0 22px; }
.table-title {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-family: "Source Serif 4", "Noto Serif SC", serif;
  color: var(--ink);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
  background: #fff;
}
.data-table th,
.data-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: #eef4f0;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody tr:nth-child(even) td { background: #fafcfb; }
.table-note { margin: 8px 0 0; font-size: 12px; }
.img-fail {
  aspect-ratio: 16/10;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-deep);
}
