:root {
  --bg: #f3efe6;
  --paper: #fffdf8;
  --paper-strong: #fff7ea;
  --ink: #1f2b24;
  --muted: #5e6d63;
  --line: rgba(31, 43, 36, 0.12);
  --active: #0f766e;
  --active-soft: rgba(15, 118, 110, 0.12);
  --done: #3f8f55;
  --done-soft: rgba(63, 143, 85, 0.12);
  --pending: #9da79f;
  --danger: #b74b32;
  --danger-soft: rgba(183, 75, 50, 0.12);
  --shadow: 0 16px 40px rgba(47, 62, 56, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.1), transparent 32%),
    radial-gradient(circle at top right, rgba(183, 75, 50, 0.08), transparent 25%),
    linear-gradient(180deg, #f6f2e9 0%, var(--bg) 100%);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.hero h1,
.hero h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-actions,
.inline-actions,
.page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.secondary {
  background: rgba(31, 43, 36, 0.08);
  color: var(--ink);
}

.btn.primary {
  background: linear-gradient(135deg, #125f59 0%, var(--active) 100%);
}

.btn.warn {
  background: linear-gradient(135deg, #b65438 0%, var(--danger) 100%);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.section {
  margin-top: 24px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.card {
  padding: 18px;
}

.card h3,
.panel h3 {
  margin: 0 0 8px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 43, 36, 0.08);
  color: var(--muted);
  font-size: 0.92rem;
}

.tag.active {
  background: var(--active-soft);
  color: var(--active);
}

.tag.done {
  background: var(--done-soft);
  color: var(--done);
}

.tag.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.stat {
  padding: 16px;
  border-radius: 18px;
  background: rgba(31, 43, 36, 0.05);
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-value {
  margin-top: 8px;
  font-size: 1.4rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: rgba(31, 43, 36, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #125f59 0%, #0f766e 100%);
  transition: width 0.25s ease;
}

.flowchart-panel {
  padding: 20px;
}

.flowchart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.88);
  color: var(--muted);
}

.legend-chip.pending {
  border-color: rgba(157, 167, 159, 0.45);
}

.legend-chip.active {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--active);
}

.legend-chip.completed {
  background: rgba(31, 43, 36, 0.88);
  border-color: rgba(31, 43, 36, 0.92);
  color: #fff;
}

.flowchart-summary {
  margin: 14px 0 16px;
  color: var(--muted);
}

.flowchart-scroll {
  overflow: auto;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96) 0%, rgba(248, 242, 232, 0.94) 100%);
  -webkit-overflow-scrolling: touch;
}

.flowchart-frame {
  position: relative;
  width: 100%;
  min-width: 860px;
  aspect-ratio: var(--flowchart-ratio, 1555 / 2200);
}

.flowchart-image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(31, 43, 36, 0.14);
}

.flowchart-overlay {
  position: absolute;
  inset: 0;
}

.flow-node {
  position: absolute;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(157, 167, 159, 0.38);
  background: rgba(255, 253, 248, 0.06);
  mix-blend-mode: multiply;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.flow-node:hover,
.flow-node:focus-visible {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
  outline: 0;
}

.flow-node.pending {
  border-color: rgba(157, 167, 159, 0.34);
  background: rgba(255, 253, 248, 0.08);
}

.flow-node.active {
  border-color: rgba(15, 118, 110, 0.85);
  background: rgba(15, 118, 110, 0.24);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.22);
  animation: flow-pulse 1.8s ease-in-out infinite;
}

.flow-node.completed {
  border-color: rgba(31, 43, 36, 0.72);
  background: rgba(31, 43, 36, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.step-list {
  display: grid;
  gap: 14px;
}

.step-card {
  position: relative;
  padding: 18px 18px 18px 58px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}

.step-card::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 22px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--pending);
  background: var(--paper);
}

.step-card.active {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.22);
}

.step-card.active::before {
  border-color: var(--active);
  background: var(--active);
  box-shadow: 0 0 0 7px rgba(15, 118, 110, 0.15);
}

.step-card.completed {
  background: rgba(63, 143, 85, 0.08);
  border-color: rgba(63, 143, 85, 0.22);
}

.step-card.completed::before {
  border-color: var(--done);
  background: var(--done);
}

.step-card.pending {
  opacity: 0.88;
}

.step-card.flash {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.24), var(--shadow);
}

.step-no {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.step-title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.step-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.event-list {
  display: grid;
  gap: 12px;
}

.stage-panel {
  padding: 20px;
  margin-bottom: 16px;
}

.module-stage-panel {
  padding: 20px;
  margin-bottom: 16px;
}

.module-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.module-card {
  display: grid;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.module-card:hover,
.module-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12), var(--shadow);
  border-color: rgba(15, 118, 110, 0.22);
  outline: 0;
}

.module-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.module-card h4 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.module-code {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.module-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.stage-summary-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  min-height: 0;
}

.stage-summary-head,
.stage-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.stage-summary-head h3,
.stage-panel-title {
  margin: 0;
  flex: 1 1 220px;
  min-width: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stage-summary-meta {
  margin-top: 0;
}

.task-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.task-remark-block {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(31, 43, 36, 0.05);
}

.task-remark-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.task-remark-input {
  width: 100%;
  min-height: 104px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  resize: vertical;
  outline: none;
}

.task-remark-input:focus {
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.task-remark-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.task-remark-meta {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-remark-display {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.task-btn {
  min-height: 36px;
  padding: 0 14px;
}

.task-btn.is-current {
  background: rgba(15, 118, 110, 0.16);
  color: var(--active);
}

.event-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(31, 43, 36, 0.05);
}

.event-item strong {
  display: block;
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.field textarea {
  min-height: 176px;
  resize: vertical;
}

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(31, 43, 36, 0.06);
  color: var(--muted);
}

.notice.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@keyframes flow-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.18);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.08);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 24px, 1100px);
    padding-top: 16px;
  }

  .section {
    margin-top: 18px;
  }

  .section-head {
    margin-bottom: 10px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-actions,
  .page-actions,
  .inline-actions {
    width: 100%;
  }

  .btn {
    flex: 1 1 140px;
  }

  .flowchart-scroll {
    padding: 10px;
  }

  .flowchart-frame {
    min-width: 760px;
  }

  .step-card {
    padding: 16px 14px 16px 48px;
  }

  .step-card::before {
    left: 16px;
    top: 18px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .module-stage-panel {
    padding: 16px;
    margin-bottom: 0;
  }

  .module-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .module-card-head .tag {
    align-self: flex-start;
  }

  #stageSummary {
    gap: 10px;
    align-items: start;
  }

  #stageSummary .card {
    height: auto;
    min-height: 0;
    align-self: start;
  }

  #stepList {
    display: grid;
    gap: 10px;
  }

  .stage-summary-head,
  .stage-panel-head,
  .task-remark-footer {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
  }

  .stage-summary-head .tag,
  .stage-panel-head .tag,
  .task-remark-footer .btn {
    align-self: flex-start;
  }

  .stage-summary-head,
  .stage-panel-head {
    display: block;
  }

  .stage-summary-head h3,
  .stage-panel-head h3 {
    margin-bottom: 8px;
  }

  .stage-summary-meta {
    margin: 0 0 10px;
  }

  .task-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .card {
    padding: 14px;
  }

  .stage-panel {
    padding: 16px;
    margin-bottom: 0;
  }

  .step-list {
    gap: 10px;
  }
}
