:root {
  --bg: #f6f5f2; --card: #fff; --ink: #1f2a2a; --sub: #66706f; --line: #e2e0da;
  --accent: #2f6f68; --accent-soft: #e3efed; --warn: #b5452f; --warn-soft: #f8e6e1;
  --r: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.5; }

#bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
#bar h1 { flex: 1; margin: 0; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view { padding: 12px 12px calc(env(safe-area-inset-bottom) + 96px); max-width: 640px; margin: 0 auto; }

button, .btn {
  font: inherit; border: 0; border-radius: var(--r); padding: 10px 16px; min-height: 44px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button.ghost, .btn.ghost, .ghost { background: var(--accent-soft); color: var(--accent); }
.danger { background: var(--warn-soft); color: var(--warn); }
button.icon { background: none; color: var(--accent); font-size: 30px; padding: 0 8px; min-height: 40px; line-height: 1; }
.small { min-height: 34px; padding: 4px 12px; font-size: 15px; }
.fab {
  position: fixed; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 4;
  border-radius: 28px; padding: 14px 22px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}

.card { background: var(--card); border-radius: var(--r); padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); }
.card h2 { font-size: 15px; color: var(--sub); margin: 0 0 6px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.sub { color: var(--sub); font-size: 14px; }
.empty { color: var(--sub); text-align: center; padding: 32px 8px; }
a.item { display: block; color: inherit; text-decoration: none; }
a.item:active { background: var(--accent-soft); }

.badge { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.grey { background: #eceae5; color: var(--sub); }

input, textarea, select {
  font: inherit; font-size: 17px; width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
label.f { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--sub); font-weight: 600; }
.search { margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 20px;
  padding: 6px 14px; min-height: 38px; font-weight: 500;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.add { color: var(--accent); border-style: dashed; }
.scale .chips { flex-wrap: nowrap; gap: 6px; }
.scale .chip { flex: 1; padding: 6px 0; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 52px; height: 30px; accent-color: var(--warn); }
.risk { border-color: var(--warn); background: var(--warn-soft); }

.list-line { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); }
.list-line:first-child { border-top: 0; }
.list-line input[type=checkbox] { width: 22px; height: 22px; margin-top: 3px; flex: none; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.spark i { flex: 1; max-width: 22px; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .8; }

.actions { display: flex; gap: 8px; margin-top: 16px; }
.actions > * { flex: 1; }
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%);
  background: #1f2a2a; color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 15px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10;
}
#toast.show { opacity: .92; }
.notice { background: #fff6dc; border: 1px solid #ecd9a0; }
[hidden] { display: none !important; }
