:root {
  --green-900: #123a30;
  --green-800: #174f43;
  --green-700: #1d6451;
  --green-600: #2a7a61;
  --green-100: #e3f0e7;
  --green-50: #f2f7f3;
  --ink: #19352d;
  --muted: #6f8177;
  --line: #dbe5dd;
  --paper: #ffffff;
  --canvas: #f4f6f1;
  --danger: #a63d2f;
  --danger-soft: #fbeae6;
  --warn: #8a5a12;
  --warn-soft: #fdf2dc;
  --ok: #1f6b4a;
  --ok-soft: #e5f4ea;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(23, 58, 42, .08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
a { color: var(--green-700); }

:focus-visible {
  outline: 3px solid #7fb99d;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  background: var(--green-800);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  transition: background .15s ease, transform .1s ease;
}
.btn:hover { background: var(--green-700); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-800);
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 650;
}
.btn-danger {
  border: 0;
  background: var(--danger);
  color: #fff;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
}
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--green-700);
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 650;
}
.btn-ghost:hover { background: var(--green-100); }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: #edf2ec;
  color: var(--green-800);
  font-size: 24px;
  line-height: 1;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: #466254;
  margin: 0 0 6px;
}

.text-input, .select-input, .textarea-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 12px 14px;
  font-size: 16px;
  outline: none;
}
.text-input:focus, .select-input:focus, .textarea-input:focus {
  border-color: #76ab90;
  box-shadow: 0 0 0 3px rgba(118, 171, 144, .18);
}

.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.form-error { color: var(--danger); font-size: 14px; min-height: 1.4em; }
.form-ok { color: var(--ok); font-size: 14px; min-height: 1.4em; }

.notice {
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
  border: 1px solid #f0dcb5;
  margin: 12px 0;
}
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: #f3cfc7; }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e6d2; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 28, 22, .48);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 40px;
}
.overlay[hidden] { display: none; }

.sheet {
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: #fbfcf9;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  animation: sheetUp .18s ease-out;
}

@keyframes sheetUp {
  from { transform: translateY(18px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sheet-head h2 { font-size: 20px; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.sheet-actions > * { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(92vw, 520px);
  background: #173f33;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
  text-align: center;
}
.toast[hidden] { display: none; }

@media (min-width: 720px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; max-height: 88vh; animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
