:root {
  color-scheme: light;
  --page: #f2f5f1;
  --card: #fff;
  --ink: #182d25;
  --muted: #4e655b;
  --line: #d6e3da;
  --strong: #174132;
  --primary: #1d634a;
  --primary-dark: #164d39;
  --tint: #e9f3ed;
  --warn: #784419;
  --warn-bg: #fff2df;
  --error: #852c27;
  font: 16px/1.55 "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.25rem, 5vw, 1.65rem); line-height: 1.25; }
h2 { font-size: 1.15rem; line-height: 1.35; }
h3 { font-size: 1rem; line-height: 1.4; }
small, .muted { color: var(--muted); }
a { color: var(--primary); text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #73a989;
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: .55; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 14px max(16px, calc((100% - 680px) / 2));
  color: #fff;
  background: var(--strong);
}
.brand { display: flex; align-items: center; min-width: 0; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: #204c39;
  background: #dceedf;
  font-weight: 750;
}
.brand h1, .brand strong { overflow-wrap: anywhere; }
.lede { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.topbar .lede { color: #d0e2d6; }
.header-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.wrap { width: min(680px, calc(100% - 24px)); margin: 14px auto 0; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
.panel { padding: 15px; margin-bottom: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.panel > h2 { margin-bottom: 10px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 7px 12px; margin-bottom: 12px; }
.head > div { min-width: 0; }
.head h2, .head p { overflow-wrap: anywhere; }
.head p { margin-top: 4px; color: var(--muted); font-size: .875rem; }
.fields { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
.fields > label, .fields .field { display: grid; align-content: start; gap: 4px; min-width: 0; font-size: .875rem; font-weight: 650; }
.fields .wide, .fields .check, .fields .photo-control { grid-column: 1 / -1; }
.fields small { font-weight: 400; }
input:not([type="checkbox"], [type="radio"], [type="file"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bfcec3;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 400;
}
textarea { min-height: 80px; resize: vertical; }
.fields .check { display: flex; gap: 8px; align-items: center; min-height: 36px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.head .actions { margin-top: 0; }
.start-actions { margin-bottom: 10px; }
.navigation { margin: -7px 0 5px -8px; }
.section-head { margin-top: 14px; }
.primary, .secondary, .plain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.primary { color: #fff; background: var(--primary); }
.primary:hover { background: var(--primary-dark); }
.secondary { border-color: #c6d7cb; color: var(--primary-dark); background: #fff; }
.secondary:hover, .plain:hover { background: var(--tint); }
.plain { color: var(--primary-dark); background: transparent; }
.header-actions .plain, .header-actions .secondary { color: #fff; border-color: #81a894; background: transparent; }
.header-actions .plain:hover, .header-actions .secondary:hover { background: #285b48; }

.project-list { display: grid; gap: 7px; list-style: none; padding: 0; margin: 0; }
.item {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  overflow-wrap: anywhere;
}
button.item, a.item { width: 100%; text-decoration: none; }
button.item:hover, a.item:hover, .item[aria-current="true"] { border-color: #a8cab5; background: var(--tint); }
.item > div:first-child { min-width: 0; }
.item-title { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; min-width: 0; }
.item > .item-meta { text-align: right; justify-content: flex-end; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 3px; color: var(--muted); font-size: .8125rem; }
.item-meta .chip { color: var(--primary-dark); }
.chip { display: inline-block; padding: 2px 7px; border-radius: 999px; color: var(--primary-dark); background: var(--tint); font-size: .75rem; white-space: nowrap; }
.chip.warn { color: var(--warn); background: var(--warn-bg); }
.chip.error, .note.error { color: var(--error); background: #fdf0ed; }
.note { margin: 8px 0; padding: 8px 10px; border-radius: 7px; color: var(--primary-dark); background: var(--tint); font-size: .875rem; overflow-wrap: anywhere; }
.note.warn { color: var(--warn); background: var(--warn-bg); }
.empty { padding: 16px 10px; color: var(--muted); text-align: center; border: 1px dashed #bfd1c5; border-radius: 8px; }
.notice { position: fixed; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); z-index: 5; padding: 9px 12px; color: #fff; background: var(--strong); border-radius: 8px; box-shadow: 0 6px 18px #18372b22; font-size: .875rem; overflow-wrap: anywhere; }
.notice.error { background: var(--error); }

.photo-control { display: grid; gap: 6px; }
.photo-control input[type="file"] { max-width: 100%; overflow: hidden; color: var(--muted); font-size: .875rem; }
.photo-control input[type="file"]::file-selector-button {
  margin-right: 6px;
  min-height: 44px;
  padding: 6px 10px;
  color: var(--primary-dark);
  background: var(--tint);
  border: 1px solid #bfd1c5;
  border-radius: 7px;
  font: inherit;
}
.preview-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(105px,1fr)); gap: 8px; padding: 0; margin: 8px 0 0; list-style: none; }
.preview { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: .75rem; }
.preview img, img.preview { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--page); border: 1px solid var(--line); border-radius: 7px; }
.preview .plain { font-size: .75rem; }

dialog { width: min(650px, calc(100% - 20px)); max-height: calc(100dvh - 20px); padding: 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 12px; }
dialog::backdrop { background: #112b21a6; }
dialog .panel { margin: 0; border: 0; padding: 0; }

@media (min-width: 580px) {
  .wrap { margin-top: 20px; }
  .panel { padding: 18px; }
  .fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 370px) {
  .topbar { padding-inline: 12px; }
  .wrap { width: calc(100% - 16px); }
  .panel { padding: 11px; }
}
