:root {
  --bg: #f7f6f1;
  --surface: #ffffff;
  --text: #22301f;
  --muted: #6b7566;
  --border: #e2e0d6;
  --brand: #3f7d3a;
  --brand-ink: #ffffff;
  --brand-soft: #e6f0e1;
  --sow: #c9932e;
  --plant: #4d8fcf;
  --harvest: #d9534f;
  --warn: #c0392b;
  --notice-bg: #fff7e0;
  --notice-border: #ecd28b;
  --now: rgba(63, 125, 58, 0.14);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151a14; --surface: #1e251c; --text: #e6ebe2; --muted: #9aa695; --border: #313b2e;
    --brand: #7cc06f; --brand-ink: #10200c; --brand-soft: #253322; --notice-bg: #2e2a1a; --notice-border: #5c5025;
    --warn: #ff7a6b; --now: rgba(124, 192, 111, 0.18); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  line-height: 1.7; font-size: 15px;
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 0.4em 0; }
h2 { font-size: 1.2rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1rem; margin: 0.4em 0; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.warn { color: var(--warn); font-weight: 600; }

.pr-note { margin: 10px 0 0; font-size: 0.78rem; color: var(--muted); }
.site-header {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.logo { font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--text); }
.region-label { font-size: 0.8rem; color: var(--muted); background: var(--brand-soft); padding: 2px 10px; border-radius: 99px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.nav a { text-decoration: none; color: var(--text); padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 0.92rem; }
.nav a.active { background: var(--brand); color: var(--brand-ink); }
@media (max-width: 640px) {
  .nav { margin-left: 0; width: 100%; }
}

.hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 20px; }
.region { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 10px; }
.region p { flex-basis: 100%; margin: 0; }
select, input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.veg-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.veg-tile:hover { border-color: var(--brand); }
.emoji { font-size: 1.8rem; line-height: 1; }
.emoji.big { font-size: 3rem; }
.tag { display: inline-block; font-size: 0.72rem; padding: 1px 8px; border-radius: 99px; background: var(--brand-soft); color: var(--text); }
.tag.sow { background: color-mix(in srgb, var(--sow) 25%, transparent); }
.tag.plant { background: color-mix(in srgb, var(--plant) 25%, transparent); }
.tag.type-pest { background: color-mix(in srgb, var(--sow) 25%, transparent); }
.tag.type-disease { background: color-mix(in srgb, var(--plant) 25%, transparent); }
.tag.type-disorder { background: color-mix(in srgb, var(--harvest) 20%, transparent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: 4px 12px; border-radius: 99px; font-size: 0.9rem; }
.chip small { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card header h3 { margin: 0; }
.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }

.btn { font: inherit; cursor: pointer; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--surface); color: var(--brand); margin-top: 8px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.icon-btn { margin-left: auto; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

.notice { background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: 8px; padding: 10px 12px; font-size: 0.85rem; }

/* products */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 10px; }
.product {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text); background: var(--bg);
}
.product:hover { border-color: var(--brand); }
.product-kind { font-size: 0.7rem; color: var(--muted); }
.product-note { font-size: 0.8rem; color: var(--muted); flex: 1; }
.product-cta { font-size: 0.8rem; color: var(--brand); font-weight: 600; }
.pr { font-size: 0.65rem; border: 1px solid var(--muted); color: var(--muted); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
.badge.organic { align-self: flex-start; font-size: 0.68rem; background: var(--brand-soft); padding: 0 6px; border-radius: 4px; }

/* calendar */
.cal-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 0; }
.cal { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 0.85rem; }
.cal th, .cal td { border-bottom: 1px solid var(--border); }
.cal thead th { font-weight: 600; color: var(--muted); padding: 6px 0; text-align: center; }
.cal th.corner, .cal tbody th { text-align: left; padding: 6px 10px; white-space: nowrap; position: sticky; left: 0; background: var(--surface); }
.cal tbody th a { color: var(--text); text-decoration: none; }
.cal td { width: 3.5%; padding: 4px 0; vertical-align: middle; border-left: 1px solid var(--border); }
.cal td.half2 { border-left-style: dotted; }
.cal td.now { background: var(--now); }
.bar { display: block; height: 5px; margin: 2px 0; }
.bar.sow { background: var(--sow); }
.bar.plant { background: var(--plant); }
.bar.harvest { background: var(--harvest); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend .bar { width: 18px; margin: 0; }
.now-swatch { display: inline-block; width: 14px; height: 14px; background: var(--now); border: 1px solid var(--border); }
.filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 10px 0; }
.filters input[type="search"] { flex: 1; min-width: 200px; }

/* veg detail */
.veg-head { display: flex; gap: 16px; align-items: center; margin: 10px 0; }
.veg-head h1 { margin: 0; }
.veg-head p { margin: 0; }
.fert { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.fert dt { font-weight: 600; }
.fert dd { margin: 0; }
@media (max-width: 640px) { .fert { grid-template-columns: 1fr; } .fert dd { margin-bottom: 8px; } }

/* tasks */
.tasks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 10px 12px; }
.task.type-harvest { border-left-color: var(--harvest); }
.task.type-pest { border-left-color: var(--sow); }
.task.type-topdress { border-left-color: var(--plant); }
.task.is-done { opacity: 0.45; }
.task-body { flex: 1; min-width: 0; }
.task-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin-top: 3px; }
details summary { cursor: pointer; color: var(--brand); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
.form h2 { margin-top: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.toolbar h2 { margin-bottom: 0; }

.progress { position: relative; height: 8px; background: var(--brand-soft); border-radius: 99px; margin: 8px 0; }
.progress span { position: absolute; inset: 0 auto 0 0; background: var(--brand); border-radius: 99px; }
.progress i { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--harvest); }
.mini-tasks { padding-left: 0; list-style: none; font-size: 0.85rem; margin: 6px 0; }
.mini-tasks li.done { text-decoration: line-through; color: var(--muted); }

.prose { max-width: 760px; }
.site-footer { color: var(--muted); font-size: 0.8rem; padding-top: 24px; padding-bottom: 40px; border-top: 1px solid var(--border); margin-top: 40px; }

/* multi-page additions */
.breadcrumbs { margin-top: 14px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }
.pest-card h3 a, .planting h3 a, .task-head a { color: var(--text); text-decoration: none; }
.pest-card h3 a:hover, .planting h3 a:hover, .task-head a:hover { text-decoration: underline; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 24px; }
.features .card { margin: 0; }
.table-wrap { overflow-x: auto; }
.schedule { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.schedule th, .schedule td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.schedule td:first-child { white-space: nowrap; color: var(--muted); }
.schedule td:nth-child(2) { white-space: nowrap; font-weight: 600; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; max-width: 480px; }
.month { text-align: center; font-size: 0.8rem; padding: 4px 0; border-radius: 4px; background: var(--brand-soft); color: var(--muted); }
.month.on { background: var(--sow); color: #fff; font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--muted); }
a.btn { display: inline-block; text-decoration: none; }
