:root {
  --soil: #14261c;
  --leaf: #163528;
  --leaf-mid: #2a6b4a;
  --leaf-light: #3d9b68;
  --sun: #c8e6a0;
  --accent: #7cb342;
  --cream: #f3f7f2;
  --surface: #ffffff;
  --mist: #dce8df;
  --ink: #1a2420;
  --muted: #5d6b63;
  --line: rgba(22, 53, 40, 0.1);
  --danger: #c45c26;
  --radius: 18px;
  --shadow-soft: 0 10px 30px rgba(20, 38, 28, 0.08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font-display: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --swipe-actions-w: 140px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* H5 滚动条尽量细：1px 半透明绿；横向芯片区仍各自隐藏 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(42, 107, 74, 0.28) transparent;
}

*::-webkit-scrollbar {
  width: 1px;
  height: 1px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(42, 107, 74, 0.28);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:active {
  background: rgba(42, 107, 74, 0.45);
}

html {
  height: 100%;
}

html,
body {
  width: 100%;
  border-radius: 0 !important;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* 贴齐屏幕四边（安卓 / iOS 统一，避免再把高度算矮） */
#app {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 430px;
  height: auto;
  margin: 0 auto;
  border-radius: 0 !important;
  box-shadow: none !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 120px),
    var(--cream);
  overflow: hidden;
}

/*
 * iOS PWA：innerHeight(797) 常小于 screen.height(844)，底部会空出约状态栏高度。
 * 用 --app-height = screen/outer 铺满物理屏。
 */
html.is-ios-pwa,
html.is-ios-pwa body {
  background: #fff;
  height: var(--app-height, 100vh);
  min-height: var(--app-height, 100vh);
  overflow: hidden;
}

html.is-ios-pwa #app {
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  height: var(--app-height, 100vh);
  min-height: var(--app-height, 100vh);
}

html.is-ios-pwa .hero-compact {
  padding-top: calc(48px + env(safe-area-inset-top, 0px));
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  border-radius: 0 !important;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
  z-index: 1;
}

.view.slide-back {
  transform: translateX(-12px);
}

#app.subpage .tabbar {
  transform: translateY(110%);
  pointer-events: none;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 42vh;
  padding: 52px 24px 28px;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 0 !important;
}

.hero-compact {
  min-height: 30vh;
  padding: 48px 24px 40px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 85% 15%, rgba(200, 230, 160, 0.45), transparent 50%),
    radial-gradient(ellipse 60% 50% at 5% 90%, rgba(61, 155, 104, 0.35), transparent 55%),
    linear-gradient(160deg, #0c2218 0%, #163528 42%, #1f4d35 100%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}

.hero-bg::before {
  content: "";
  position: absolute;
  inset: auto -20% -30% -20%;
  height: 55%;
  background: radial-gradient(ellipse at 50% 0%, rgba(200, 230, 160, 0.12), transparent 70%);
  animation: mistDrift 10s ease-in-out infinite alternate;
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M36 10c2.5 10 10 17.5 20 20-10 2.5-17.5 10-20 20-2.5-10-10-17.5-20-20 10-2.5 17.5-10 20-20z' fill='%23ffffff' fill-opacity='0.05'/%3E%3C/svg%3E");
  opacity: 1;
}

@keyframes mistDrift {
  from { transform: translateY(0); opacity: 0.7; }
  to { transform: translateY(-12px); opacity: 1; }
}

@keyframes heroGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.08); }
}

.hero-content {
  position: relative;
  z-index: 1;
  animation: riseIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.brand {
  font-family: var(--font-display);
  font-size: clamp(3rem, 13vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.05;
  text-indent: 0.08em;
  text-shadow: 0 6px 32px rgba(0, 0, 0, 0.32);
}

.hero-title {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.48em;
  color: var(--sun);
  text-indent: 0.48em;
}

.hero-sub {
  margin-top: 14px;
  max-width: 16em;
  font-size: 0.88rem;
  line-height: 1.7;
  color: rgba(243, 247, 242, 0.72);
}

/* —— Home list —— */
#view-home {
  display: flex;
  flex-direction: column;
}

.home-page {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-main {
  margin-top: -22px;
  padding: 22px 18px calc(28px + var(--safe-b));
  border-radius: 0;
  background:
    linear-gradient(180deg, #f7faf6 0%, var(--cream) 48px);
  position: relative;
  z-index: 2;
  box-shadow: 0 -8px 28px rgba(12, 34, 24, 0.12);
  animation: riseIn 0.75s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home-filters {
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.section-add {
  width: 36px;
  height: 36px;
  font-size: 1.35rem;
}

.home-region-hint {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.plot-empty {
  padding: 28px 12px 20px;
}

.plot-empty p {
  margin-bottom: 16px;
}

.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  margin: 0 auto;
}

.empty-btn {
  margin-top: 0;
  width: 100%;
}

.home-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
  padding-bottom: 8px;
}

.home-link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  padding: 14px 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--leaf);
}

.home-link > span:first-child {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.home-link-desc {
  grid-column: 1;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.home-link-arrow {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-size: 1.2rem;
  color: var(--leaf-mid);
  opacity: 0.45;
}

#view-catalog {
  display: flex;
  flex-direction: column;
}

.catalog-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px calc(28px + var(--safe-b));
}

.catalog-intro {
  margin-bottom: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.catalog-filters {
  margin-bottom: 4px;
}

.catalog-count-row {
  margin-top: 6px;
  margin-bottom: 8px;
}

.catalog-count-row h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--leaf);
}

.veg-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.veg-join-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 999px;
  background: rgba(42, 107, 74, 0.12);
  color: var(--leaf-mid);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.veg-join-btn.in-plot {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  pointer-events: none;
}

.detail-plot-actions {
  padding: 0 20px 12px;
  display: flex;
  gap: 8px;
}

.detail-plot-btn {
  margin-top: 0;
  flex: 1;
  padding: 11px;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.add-crop-field {
  margin-bottom: 12px;
}

.add-crop-catalog-btn {
  width: 100%;
  margin-top: 8px;
}

.sheet-panel-pest {
  max-height: min(78vh, 560px);
  display: flex;
  flex-direction: column;
}

.pest-manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.pest-manage-list:empty {
  display: none;
}

.pest-manage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(22, 53, 40, 0.08);
}

.pest-manage-item span {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.pest-manage-item .mine-pest-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 6px;
  cursor: pointer;
}

.pest-manage-empty {
  margin: 8px 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
}

.pest-manage-empty[hidden] {
  display: none;
}

.pest-add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(22, 53, 40, 0.08);
  flex-shrink: 0;
}

.pest-add-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(22, 53, 40, 0.12);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
}

.pest-add-row input:focus {
  border-color: rgba(42, 107, 74, 0.35);
  box-shadow: 0 0 0 3px rgba(61, 155, 104, 0.12);
}

.pest-add-row .primary-btn {
  flex-shrink: 0;
  width: auto;
  padding: 12px 16px;
  margin: 0;
}

.pest-pick {
  margin: 0 0 12px;
}

.pest-pick-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--leaf);
}

.pest-chip-scroll {
  padding: 2px 0 8px;
  margin: 0;
}

.pest-chip-scroll .chip {
  font-size: 0.82rem;
}

.mine-backup-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.mine-backup-actions .ghost-btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 0.85rem;
}

.kb-card-emoji {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(42, 107, 74, 0.1);
  font-size: 1.15rem;
  flex-shrink: 0;
  overflow: hidden;
}

/* 封面图：保持原 emoji 槽尺寸，勿用 100% 以免撑满整行 */
img.kb-card-emoji.is-cover,
img.veg-emoji.is-cover,
img.log-group-emoji.is-cover,
img.plant-care-emoji.is-cover,
img.tl-emoji.is-cover,
img.log-veg-icon.is-cover,
img.plan-veg-icon.is-cover,
img.suggest-emoji.is-cover {
  object-fit: cover;
  object-position: center;
  padding: 0;
  border: none;
  box-sizing: border-box;
}

.detail-emoji.has-cover {
  padding: 0;
}

.detail-emoji.has-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.kb-card-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--leaf-mid);
  letter-spacing: 0.06em;
}

#view-knowledge,
#view-knowledge-detail {
  display: flex;
  flex-direction: column;
}

.kb-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px calc(28px + var(--safe-b));
}

.catalog-search-box,
.kb-search-box {
  margin-bottom: 12px;
}

.kb-intro {
  margin-bottom: 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}

.kb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kb-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.kb-list-item:active {
  transform: scale(0.985);
}

.kb-list-item .kb-card-emoji {
  flex-shrink: 0;
}

.kb-list-meta {
  flex: 1;
  min-width: 0;
}

.kb-list-meta h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--leaf);
}

.kb-list-meta p {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-list-arrow {
  color: var(--leaf-mid);
  opacity: 0.45;
  font-size: 1.15rem;
}

.kb-article {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(32px + var(--safe-b));
}

.kb-article-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.kb-article-hero .kb-card-emoji {
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  border-radius: 16px;
}

.kb-article-hero .kb-card-tag {
  margin-bottom: 4px;
}

.kb-article-hero h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--leaf);
  line-height: 1.35;
}

.kb-article .lead {
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--muted);
}

.kb-article h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--leaf);
  margin: 18px 0 8px;
}

.kb-article p,
.kb-article li {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #2e3832;
}

.kb-article ul {
  padding-left: 1.15em;
}

.kb-article li + li {
  margin-top: 6px;
}

.home-sticky {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: 0 -18px;
  padding: 12px 18px 10px;
  background: rgba(243, 247, 242, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.2s ease;
}

.home-sticky.is-stuck {
  box-shadow: 0 10px 24px rgba(20, 38, 28, 0.08);
}

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

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--leaf);
}

.count {
  font-size: 0.8rem;
  color: var(--muted);
}

.veg-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.veg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(22, 53, 40, 0.06);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.veg-item:active {
  border-color: rgba(42, 107, 74, 0.22);
  box-shadow: var(--shadow-soft);
  transform: scale(0.985);
}

.catalog-veg-item {
  cursor: default;
  padding-right: 10px;
}

.catalog-veg-item:active {
  transform: none;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  border-color: rgba(22, 53, 40, 0.06);
}

.veg-item-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.veg-emoji {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-size: 1.75rem;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 25%, rgba(200, 230, 160, 0.55), transparent 50%),
    linear-gradient(145deg, rgba(61, 155, 104, 0.16), rgba(22, 53, 40, 0.08));
  flex-shrink: 0;
  overflow: hidden;
}

.veg-meta {
  flex: 1;
  min-width: 0;
}

.veg-meta h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--leaf);
}

.veg-meta p {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.veg-arrow {
  color: var(--leaf-mid);
  font-size: 1.2rem;
  opacity: 0.45;
}

.veg-badge {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 9px;
  font-size: 0.68rem;
  color: var(--leaf-mid);
  background: rgba(42, 107, 74, 0.1);
  border-radius: 999px;
}

/* —— Page bar —— */
.page-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--cream);
  flex-shrink: 0;
}

.page-bar h1 {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--leaf);
  text-align: center;
}

.page-bar-solo {
  padding-left: 18px;
  padding-right: 12px;
}

.page-bar-solo h1 {
  text-align: left;
}

.back-btn,
.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: rgba(22, 53, 40, 0.08);
  color: var(--leaf);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.back-btn:active,
.icon-btn:active {
  background: rgba(22, 53, 40, 0.16);
}

.bar-spacer {
  width: 40px;
}

/* —— Detail —— */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px 16px;
  flex-shrink: 0;
}

.detail-emoji {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 30%, rgba(200, 230, 160, 0.45), transparent 50%),
    linear-gradient(160deg, #0c2218, #2a6b4a);
  animation: popIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.detail-tag {
  font-size: 0.75rem;
  color: var(--leaf-mid);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.detail-brief {
  margin-top: 6px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab.active {
  color: var(--leaf);
  font-weight: 700;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2.5px;
  border-radius: 2px;
  background: var(--leaf-mid);
  animation: tabIn 0.25s ease;
}

@keyframes tabIn {
  from { transform: scaleX(0.4); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

.tab-panels {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px calc(28px + var(--safe-b));
}

.panel {
  display: none;
  animation: fadeUp 0.3s ease both;
}

.panel.active {
  display: block;
}

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

.panel h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--leaf);
  margin: 18px 0 8px;
}

.panel h3:first-child {
  margin-top: 0;
}

.panel p,
.panel li {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #2e3832;
}

.panel ul {
  padding-left: 1.15em;
}

.panel li + li {
  margin-top: 6px;
}

.tip-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: rgba(124, 179, 66, 0.12);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--soil);
}

.nutri-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.nutri-label {
  width: 2.5em;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--leaf);
}

.nutri-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: rgba(22, 53, 40, 0.1);
  overflow: hidden;
}

.nutri-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--leaf-mid), var(--leaf-light));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.nutri-val {
  font-size: 0.75rem;
  color: var(--muted);
  width: 2em;
  text-align: right;
}

/* —— Logs —— */
.empty-hint {
  padding: 40px 20px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
}

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.log-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

/* 左滑：修改 / 删除 */
.swipe-row {
  position: relative;
  list-style: none;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: var(--swipe-actions-w, 140px);
  z-index: 0;
}

.swipe-btn {
  flex: 1;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
}

.swipe-btn.swipe-edit {
  background: var(--leaf-mid);
}

.swipe-btn.swipe-delete {
  background: var(--danger);
}

.swipe-content {
  position: relative;
  z-index: 1;
  background: var(--cream);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  touch-action: pan-y;
}

.swipe-content.is-dragging {
  transition: none;
}

.swipe-face {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  align-items: start;
}

.hub-list .swipe-content,
.plant-care-body .swipe-content,
#panel-logs .swipe-content {
  background: var(--cream);
}

.care-log-list .swipe-row:last-child,
.log-list .swipe-row:last-child {
  border-bottom: none;
}

.log-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--leaf-light);
  box-shadow: 0 0 0 3px rgba(61, 155, 104, 0.22);
}

.log-body h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--leaf);
}

.log-body p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

.log-time {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.log-del {
  grid-column: 2;
  margin-top: 6px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.75rem;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  text-align: left;
}

/* —— Record form —— */
.record-form {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-x: none;
  padding: 8px 20px calc(28px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.record-form .field {
  min-width: 0;
  max-width: 100%;
}

/* WebKit/Blink datetime-local 固有最小宽度常超过屏宽，用裁剪壳锁死 */
.datetime-clip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.2s;
}

.datetime-clip:focus-within {
  border-color: var(--leaf-mid);
}

.record-form .datetime-clip input[type="datetime-local"],
.datetime-clip input[type="datetime-local"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  margin: 0;
  padding: 12px 10px;
  border: none !important;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  box-sizing: border-box;
  /* 部分浏览器内部控件仍按内容撑开，强制参与收缩 */
  flex: 1 1 auto;
  -webkit-appearance: none;
  appearance: none;
}

.record-form .field input,
.record-form .field textarea,
.record-form .field select {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.record-form .chip-scroll {
  max-width: 100%;
  overscroll-behavior-x: contain;
}

.record-form .type-grid,
.record-form .type-grid-stage {
  min-width: 0;
  width: 100%;
}

.form-veg {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--leaf-mid);
  margin-bottom: 20px;
}

.field-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.veg-combo {
  position: relative;
  z-index: 2;
}

.veg-combo.is-open input[type="search"] {
  border-color: var(--leaf-mid);
}

.veg-combo input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.veg-combo input[type="search"]:focus {
  border-color: var(--leaf-mid);
}

.veg-suggest {
  position: fixed;
  z-index: 50;
  list-style: none;
  max-height: min(220px, 40vh);
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  border: 1px solid rgba(22, 53, 40, 0.1);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(20, 38, 28, 0.16);
  -webkit-overflow-scrolling: touch;
}

.veg-suggest li button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.veg-suggest li button:active,
.veg-suggest li button:hover {
  background: rgba(42, 107, 74, 0.1);
}

.veg-suggest .suggest-emoji {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  object-fit: cover;
  font-size: 1.05rem;
  background: rgba(42, 107, 74, 0.08);
}

.veg-suggest img.suggest-emoji {
  display: block;
  padding: 0;
}

.veg-suggest .suggest-custom {
  color: var(--leaf-mid);
  font-weight: 700;
}

.veg-suggest .suggest-empty {
  padding: 12px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.field {
  display: block;
  margin-bottom: 20px;
  border: none;
}

.field > span,
.field legend {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--leaf);
  margin-bottom: 8px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--leaf-mid) 50%),
    linear-gradient(135deg, var(--leaf-mid) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--leaf-mid);
}

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

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.type-grid-stage {
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.type-grid-stage label {
  padding: 10px 4px;
  font-size: 0.7rem;
}

/* —— Growth timeline —— */
.tl-card {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
}

.tl-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tl-mini-line {
  margin-top: 2px !important;
  font-size: 0.75rem !important;
  color: var(--muted) !important;
}

.tl-mini-bar {
  display: block;
  margin-top: 8px;
  height: 4px;
  border-radius: 999px;
  background: rgba(22, 53, 40, 0.08);
  overflow: hidden;
}

.tl-mini-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2a6b4a, #3d9b68);
}

.tl-card-single {
  margin-bottom: 8px;
}

.tl-emoji {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(61, 155, 104, 0.18), rgba(200, 230, 160, 0.35));
  font-size: 1.4rem;
  flex-shrink: 0;
  overflow: hidden;
}

.tl-head-text {
  flex: 1;
  min-width: 0;
}

.tl-head-text h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--leaf);
}

.tl-head-text p {
  margin-top: 3px;
  font-size: 0.75rem;
  color: var(--muted);
}

.tl-progress {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(42, 107, 74, 0.1);
  color: var(--leaf-mid);
  font-size: 0.72rem;
  font-weight: 700;
}

.tl-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
  padding: 4px 0 4px 2px;
}

.tl-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  min-height: 48px;
}

.tl-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tl-dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--mist);
  border: 1.5px solid var(--line);
  font-size: 0.95rem;
  z-index: 1;
}

.tl-step.is-done .tl-dot {
  background: rgba(42, 107, 74, 0.12);
  border-color: var(--leaf-mid);
}

.tl-connector {
  flex: 1;
  width: 2px;
  min-height: 16px;
  background: var(--line);
  margin: 2px 0;
}

.tl-connector.is-done {
  background: var(--leaf-mid);
}

.tl-connector.is-half {
  background: linear-gradient(180deg, var(--leaf-mid), var(--line));
}

.tl-step-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  gap: 8px;
}

.tl-step-body strong {
  font-size: 0.9rem;
  color: var(--ink);
}

.tl-step.is-done .tl-step-body strong {
  color: var(--leaf);
}

.tl-step-body span {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.tl-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tl-block h4 {
  font-size: 0.78rem;
  color: var(--leaf);
  margin-bottom: 8px;
}

.tl-event-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tl-event-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  font-size: 0.82rem;
  color: var(--ink);
}

.tl-event-list time {
  font-size: 0.72rem;
  color: var(--muted);
}

.tl-event-list p {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--muted);
}

.tl-care li {
  color: var(--muted);
}

.tl-empty {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.rec-type-group .rec-type-hint {
  margin: -4px 0 10px;
}

.type-opt {
  position: relative;
}

.type-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-opt label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.type-opt label span {
  font-size: 1.25rem;
}

.type-opt input:checked + label {
  border-color: var(--leaf-mid);
  background: rgba(42, 107, 74, 0.1);
  color: var(--leaf);
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  margin-top: 8px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #163528, #2a6b4a 55%, #3d9b68);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(22, 53, 40, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}

.primary-btn:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(22, 53, 40, 0.2);
}

/* —— Chips —— */
.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--leaf-mid);
  letter-spacing: 0.12em;
  margin: 8px 0 8px;
}

.chip-scroll-wrap {
  position: relative;
  margin: 0 -18px 4px;
}

.chip-scroll-wrap::before,
.chip-scroll-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 10px;
  width: 28px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.chip-scroll-wrap::before {
  left: 0;
  background: linear-gradient(90deg, #f7faf6, transparent);
}

.chip-scroll-wrap::after {
  right: 0;
  background: linear-gradient(270deg, #f7faf6, transparent);
}

.chip-scroll-wrap.show-left::before,
.chip-scroll-wrap.show-right::after {
  opacity: 1;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 18px 12px;
  margin: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  cursor: grab;
  scroll-behavior: smooth;
}

.chip-scroll.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  flex-shrink: 0;
  padding: 8px 15px;
  border: 1px solid rgba(22, 53, 40, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.chip.active {
  background: linear-gradient(135deg, #163528, #2a6b4a);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(22, 53, 40, 0.2);
}

.chip:active {
  transform: scale(0.97);
}

/* —— Records hub —— */
#view-logs-hub {
  display: flex;
  flex-direction: column;
}

.hub-page {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* 安全区由 .has-tabbar / .tabbar 处理，这里不再叠加 safe-b */
  padding-bottom: 12px;
}

.hub-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  gap: 10px;
  background: rgba(243, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.hub-top-search {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  padding: 10px 12px;
}

.hub-tools {
  padding: 4px 18px 2px;
}

.hub-tools .chip-scroll-wrap {
  margin-left: -18px;
  margin-right: -18px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(22, 53, 40, 0.08);
  box-shadow: 0 4px 16px rgba(20, 38, 28, 0.04);
}

.search-box:focus-within {
  border-color: rgba(42, 107, 74, 0.35);
  box-shadow: 0 0 0 3px rgba(61, 155, 104, 0.12);
}

.search-icon {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  min-width: 0;
}

.search-box input::placeholder {
  color: #8a968e;
}

.hub-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--leaf);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.hub-sticky {
  position: sticky;
  top: 52px;
  z-index: 7;
  margin: 0;
  padding: 8px 18px 10px;
  background: rgba(243, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.2s ease;
}

.hub-sticky.is-stuck {
  box-shadow: 0 8px 18px rgba(20, 38, 28, 0.08);
}

.hub-list {
  padding: 4px 18px 24px;
}

.hub-view-modes {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(22, 53, 40, 0.06);
}

/* —— Plans —— */
.interval-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.interval-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.interval-opt {
  position: relative;
}

.interval-opt label {
  display: block;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.interval-opt input:checked + label {
  border-color: var(--leaf-mid);
  background: rgba(42, 107, 74, 0.1);
  color: var(--leaf);
  font-weight: 700;
}

.plan-card {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
}

.plan-card.is-due {
  border-color: rgba(196, 92, 38, 0.4);
  background: linear-gradient(180deg, rgba(196, 92, 38, 0.08), #fff 42%);
}

.plan-card.is-draft {
  border-style: dashed;
}

.plan-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.plan-card-head h3 {
  font-size: 0.98rem;
  color: var(--leaf);
  font-weight: 700;
}

.plan-card-head p {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.plan-badge {
  flex-shrink: 0;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(42, 107, 74, 0.1);
  color: var(--leaf-mid);
}

.plan-badge.due {
  background: rgba(196, 92, 38, 0.15);
  color: var(--danger);
}

.plan-badge.draft {
  background: rgba(107, 99, 90, 0.12);
  color: var(--muted);
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.plan-actions button {
  flex: 1;
  min-width: 30%;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--leaf);
  cursor: pointer;
}

.plan-actions .act-primary {
  background: linear-gradient(135deg, #163528, #2a6b4a);
  border-color: transparent;
  color: #fff;
}

.plan-actions .act-danger {
  color: var(--danger);
  border-color: rgba(196, 92, 38, 0.35);
}

.ghost-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.confirm-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 25, 23, 0.45);
}

.confirm-mask[hidden] {
  display: none !important;
}

.confirm-card {
  width: min(100%, 340px);
  padding: 20px 18px 16px;
  border-radius: 18px;
  background: var(--cream);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.confirm-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--leaf);
  margin-bottom: 8px;
}

.confirm-card p {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 18px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-ok {
  flex: 1;
  margin-top: 0;
  padding: 12px;
  box-shadow: none;
}

.back-top {
  position: absolute;
  right: 16px;
  bottom: calc(78px + var(--safe-b));
  z-index: 16;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #163528, #2a6b4a);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22, 53, 40, 0.28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.back-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-top:active {
  transform: scale(0.96);
}

.view-mode {
  flex: 1;
  padding: 9px 4px;
  border: none;
  border-radius: 11px;
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.view-mode.active {
  background: #fff;
  color: var(--leaf);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(20, 38, 28, 0.1);
}

.hub-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(42, 107, 74, 0.08);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--leaf);
}

.hub-summary .link-btn {
  display: inline;
  margin-left: 6px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: inherit;
  font-weight: 700;
  color: var(--leaf-mid);
  text-decoration: underline;
  cursor: pointer;
}

.hub-list .log-item,
.hub-list .swipe-face {
  grid-template-columns: 14px 1fr auto;
}

.log-veg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--leaf-mid);
  background: rgba(42, 107, 74, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.log-group {
  margin-bottom: 10px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  overflow: hidden;
}

.log-group > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.log-group > summary::-webkit-details-marker {
  display: none;
}

.log-group > summary::after {
  content: "›";
  margin-left: auto;
  color: var(--muted);
  font-size: 1.1rem;
  transition: transform 0.2s;
}

.log-group[open] > summary::after {
  transform: rotate(90deg);
}

.log-group-emoji {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(42, 107, 74, 0.1);
  font-size: 1.2rem;
  flex-shrink: 0;
  overflow: hidden;
}

.log-group-meta {
  min-width: 0;
}

.log-group-meta h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--leaf);
}

.log-group-meta p {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

.log-group .log-list {
  padding: 0 12px 8px;
  border-top: 1px solid var(--line);
}

.log-day {
  margin-bottom: 16px;
}

.log-day-title {
  position: sticky;
  top: 148px;
  z-index: 1;
  padding: 6px 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--leaf-mid);
  background: linear-gradient(var(--cream) 70%, transparent);
}

/* —— Plant care (记录区单株) —— */
#view-plant-care {
  display: flex;
  flex-direction: column;
}

.plant-care-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px calc(28px + var(--safe-b));
}

.plant-care-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  background:
    linear-gradient(145deg, rgba(200, 230, 160, 0.22), transparent 55%),
    #fff;
  box-shadow: 0 2px 12px rgba(20, 38, 28, 0.04);
  margin-bottom: 14px;
}

.plant-care-emoji {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 2rem;
  background:
    radial-gradient(circle at 30% 25%, rgba(200, 230, 160, 0.5), transparent 55%),
    linear-gradient(145deg, rgba(61, 155, 104, 0.16), rgba(22, 53, 40, 0.08));
  flex-shrink: 0;
  overflow: hidden;
}

.log-veg-icon,
.plan-veg-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(42, 107, 74, 0.1);
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
  vertical-align: middle;
}

.plan-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.plant-care-meta {
  flex: 1;
  min-width: 0;
}

.plant-care-meta h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--leaf);
}

.plant-care-stats {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.plant-care-stats p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.plant-care-stats strong {
  color: var(--leaf);
  font-weight: 700;
}

.plant-care-stats .idle-warn {
  color: var(--danger);
}

.plant-care-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: rgba(22, 53, 40, 0.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.plant-care-tabs::-webkit-scrollbar {
  display: none;
}

.plant-care-tab {
  flex: 0 0 auto;
  min-width: 3em;
  padding: 9px 10px;
  border: none;
  border-radius: 11px;
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.plant-care-tab.active {
  background: #fff;
  color: var(--leaf);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(20, 38, 28, 0.1);
}

.plant-care-body .empty-hint {
  padding: 28px 12px;
}

.care-log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.care-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.care-cal-head h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--leaf);
}

.care-cal-nav {
  display: flex;
  gap: 6px;
}

.care-cal-nav button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(22, 53, 40, 0.08);
  color: var(--leaf);
  font: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}

.care-cal-weekdays,
.care-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.care-cal-weekdays span {
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  padding: 4px 0;
}

.care-cal-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 4px rgba(20, 38, 28, 0.04);
}

.care-cal-day.muted {
  opacity: 0.35;
  pointer-events: none;
}

.care-cal-day.has-care {
  background: rgba(42, 107, 74, 0.12);
  color: var(--leaf);
  font-weight: 700;
}

.care-cal-day.has-care::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--leaf-mid);
  transform: translateX(-50%);
}

.care-cal-day.selected {
  background: linear-gradient(135deg, #163528, #2a6b4a);
  color: #fff;
}

.care-cal-day.selected::after {
  background: #fff;
}

.care-cal-day.today:not(.selected) {
  box-shadow: inset 0 0 0 1.5px rgba(42, 107, 74, 0.45);
}

.care-cal-day-detail {
  margin-top: 14px;
}

.care-cal-day-detail h4 {
  font-size: 0.85rem;
  color: var(--leaf-mid);
  margin-bottom: 8px;
}

.hub-batch-care {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 11px 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #163528, #2a6b4a);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(22, 53, 40, 0.18);
}

.hub-batch-care[hidden] {
  display: none !important;
}

.hub-plant-card.hub-plant-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  padding: 13px 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.hub-plant-card.hub-plant-entry:active {
  transform: scale(0.985);
}

.hub-plant-card .veg-arrow {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--leaf-mid);
  opacity: 0.45;
  font-size: 1.15rem;
}

.quick-care-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 6px;
}

.quick-care-tip {
  margin: 0 0 14px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

.quick-care-btn {
  padding: 10px 4px;
  border: 1px solid rgba(22, 53, 40, 0.1);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--leaf);
  cursor: pointer;
}

.quick-care-btn:active {
  background: rgba(42, 107, 74, 0.1);
}

.quick-care-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.quick-care-sheet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border: 1px solid rgba(22, 53, 40, 0.1);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--leaf);
  cursor: pointer;
}

.quick-care-sheet-btn span {
  font-size: 1.35rem;
}

.quick-care-sheet-btn:active {
  background: rgba(42, 107, 74, 0.1);
}

/* —— Mine —— */
#view-mine {
  display: flex;
  flex-direction: column;
}

.mine-page {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mine-topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  background: rgba(243, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mine-body {
  padding: 8px 18px calc(28px + var(--safe-b));
}

.mine-card {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 38, 28, 0.03);
}

.mine-card-head h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--leaf);
}

.mine-card-head p {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

.mine-account-card {
  padding: 14px;
}

.mine-account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 4px 2px;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.mine-account-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #163528, #2a6b4a);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.mine-account-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mine-account-meta strong {
  font-size: 1rem;
  font-weight: 700;
  color: var(--leaf);
}

.mine-account-meta small {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mine-account-action {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--leaf-mid);
}

.mine-logout-btn {
  display: block;
  width: 100%;
  margin: 8px 0 4px;
  padding: 12px 8px;
  font-size: 0.85rem;
  color: #8a4a42;
  border-color: rgba(138, 74, 66, 0.28);
}

.mine-logout-btn[hidden] {
  display: none !important;
}

#view-auth {
  display: flex;
  flex-direction: column;
}

.auth-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px calc(28px + var(--safe-b));
}

.auth-hero {
  margin: 8px 0 18px;
}

.auth-brand {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--leaf);
  letter-spacing: 0.06em;
}

.auth-lead {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form .field[hidden],
.auth-nick-field[hidden],
.auth-confirm-field[hidden] {
  display: none !important;
}

.auth-form .field {
  margin-bottom: 14px;
}

.auth-hint {
  margin: 4px 0 16px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
}

.auth-switch-link {
  border: none;
  background: transparent;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--leaf-mid);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(20, 38, 28, 0.42);
}

.sheet-mask[hidden] {
  display: none !important;
}

.sheet-panel {
  width: 100%;
  max-width: 430px;
  max-height: min(72vh, 520px);
  padding: 16px 18px calc(18px + var(--safe-b));
  border-radius: 22px 22px 0 0;
  background: var(--cream);
  box-shadow: 0 -12px 40px rgba(20, 38, 28, 0.18);
  animation: sheetUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@keyframes sheetUp {
  from {
    opacity: 0.6;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.sheet-head h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--leaf);
}

.sheet-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(22, 53, 40, 0.08);
  color: var(--leaf);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.sheet-desc {
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.sheet-panel-feedback {
  max-height: min(82vh, 560px);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-type-row {
  display: flex;
  gap: 8px;
}

.feedback-type-opt {
  flex: 1;
  cursor: pointer;
}

.feedback-type-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.feedback-type-opt span {
  display: block;
  padding: 10px 8px;
  border: 1px solid rgba(22, 53, 40, 0.1);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.feedback-type-opt input:checked + span {
  border-color: rgba(42, 107, 74, 0.4);
  background: rgba(42, 107, 74, 0.1);
  color: var(--leaf);
  font-weight: 700;
}

.feedback-form textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid rgba(22, 53, 40, 0.12);
  border-radius: 12px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  background: #fff;
  color: var(--ink);
}

.feedback-form textarea:focus,
.feedback-form input:focus {
  outline: 2px solid rgba(42, 107, 74, 0.22);
  border-color: rgba(42, 107, 74, 0.35);
}

.region-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.region-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 14px;
  border: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.region-list-item.active {
  border-color: rgba(42, 107, 74, 0.35);
  background: rgba(42, 107, 74, 0.08);
  color: var(--leaf);
  font-weight: 700;
}

.region-list-item .check {
  color: var(--leaf-mid);
  font-size: 1rem;
  opacity: 0;
}

.region-list-item.active .check {
  opacity: 1;
}

.mine-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: rgba(243, 247, 242, 0.65);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.mine-setting-row:active {
  border-color: rgba(42, 107, 74, 0.28);
  background: #fff;
}

.mine-setting-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--leaf);
}

.mine-setting-value {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.mine-setting-value.is-on {
  color: var(--leaf-mid);
}

.mine-foot {
  margin: 8px 0 12px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* —— Tab bar —— */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  align-items: flex-end;
  padding: 4px 6px 0;
  /* iOS 旧版 + 新版安全区；只垫一次 */
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: none;
  border-top: 1px solid rgba(22, 53, 40, 0.08);
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.view.has-tabbar {
  padding-bottom: calc(52px + constant(safe-area-inset-bottom));
  padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
  padding: 6px 0 4px;
  border: none;
  border-radius: 14px;
  background: none;
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.tabbar-item.active {
  color: var(--leaf);
  font-weight: 700;
  background: rgba(42, 107, 74, 0.1);
}

.tabbar-ico {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  transition: transform 0.2s;
}

.tabbar-item.active .tabbar-ico {
  transform: translateY(-1px);
  color: var(--leaf-mid);
}

/* —— Toast —— */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(20, 38, 28, 0.92);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 28px rgba(20, 38, 28, 0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— PWA 安装条（仅手机） —— */
.pwa-install-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 18;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(20, 38, 28, 0.16);
  backdrop-filter: blur(10px);
}

.pwa-install-bar[hidden] {
  display: none !important;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pwa-install-text strong {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 650;
}

.pwa-install-text span {
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pwa-install-later {
  padding: 8px 10px;
  font-size: 0.78rem;
  min-height: 0;
}

.pwa-install-ok {
  padding: 8px 14px;
  font-size: 0.78rem;
  min-height: 0;
  border-radius: 999px;
}

.pwa-install-bar.is-ios .pwa-install-ok {
  display: none;
}

@media (min-width: 431px) {
  body {
    background:
      radial-gradient(ellipse at 15% 0%, rgba(124, 179, 66, 0.22), transparent 42%),
      radial-gradient(ellipse at 90% 90%, rgba(42, 107, 74, 0.18), transparent 40%),
      #c5d4c8;
  }
}
