/* ==========================================================================
   Tyfu — components.
   ========================================================================== */

/* -------------------------------------------------------------- Cards ---- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1rem, 0.75rem + 1vw, 1.4rem);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card + .card { margin-top: var(--gap); }
.grid > .card + .card,
.dashboard-grid .card + .card { margin-top: 0; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-bottom: 0.9rem;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-flat { box-shadow: none; }

/* ------------------------------------------------------------ Buttons ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--tap);
  padding: 0.5rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--leaf);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background-color 0.15s ease, transform 0.05s ease;
}
.button:hover { background: var(--leaf-dark); color: #fff; }
.button:active { transform: translateY(1px); }
.button[disabled] { opacity: 0.65; cursor: progress; }

.button-secondary { background: var(--paper); color: var(--leaf-dark); border-color: var(--field-border); }
.button-secondary:hover { background: var(--leaf-wash); color: var(--leaf-dark); }

.button-accent { background: var(--accent); }
.button-accent:hover { background: var(--accent-dark); }

.button-danger { background: #fff; color: var(--danger); border-color: var(--danger-line); }
.button-danger:hover { background: var(--danger-wash); color: var(--danger-ink); }

.button-quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.button-quiet:hover { background: var(--leaf-wash); color: var(--leaf-dark); }

.button-small { min-height: 36px; padding: 0.3rem 0.85rem; font-size: 0.875rem; }
.button-block { width: 100%; }

.button-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

.link-button {
  background: none;
  border: 0;
  padding: 0.5rem 0.25rem;
  min-height: var(--tap);
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
}

/* -------------------------------------------------------------- Forms ---- */

.form-field { margin-bottom: 1.1rem; }
.form-field > label,
.field-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--ink);
}
.hint { font-size: 0.82rem; color: var(--muted); margin: 0.35rem 0 0; }

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  /* 16px or more stops iOS Safari zooming in when a field is tapped. */
  font-size: max(16px, 1rem);
  color: var(--ink);
}
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="file"] { padding: 0.45rem 0.5rem; }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: var(--leaf-wash);
  color: var(--leaf-dark);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; min-width: 0; }
legend { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; color: var(--leaf-dark); padding: 0; margin-bottom: 0.6rem; }

.form-narrow { max-width: 26rem; }

/* Radio buttons and tick boxes with a comfortable tap area. */
.choice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--tap);
  font-weight: 500;
  cursor: pointer;
}
.choice input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--leaf); }
/* A choice placed straight inside a .form-field keeps its own layout (the
   field-label rule above would otherwise make it a block). */
.form-field > .choice { display: flex; font-size: inherit; font-weight: 500; margin-bottom: 0; }
.preset-list { text-align: left; display: inline-block; margin: 0 0 1.25rem; padding-left: 1.2rem; color: var(--ink); }
.preset-list li + li { margin-top: 0.3rem; }
.h-card { font-size: 1.2rem; margin-bottom: 0.25rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filters .form-field { margin: 0; min-width: 12rem; }
.area-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0 0.75rem; }
.area-heading h2 { margin: 0; }
.where { color: var(--muted); font-size: 0.92rem; margin: -0.4rem 0 0.75rem; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.inline-fields .form-field { margin-bottom: 0; flex: 1 1 12rem; }
.inline-fields .form-field-narrow { flex: 0 1 7rem; }
.filter-box { max-width: 26rem; }

/* Month tick grid on the plant form: six a row on phones, twelve on wider screens. */
.month-picker { margin: 0 0 1rem; }
.month-picker legend { font-family: var(--font-body); font-size: 0.9rem; color: var(--ink); margin-bottom: 0.35rem; }
.month-picker-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.month-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: var(--tap);
  padding: 0.3rem 0;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}
.month-choice input { width: 24px; height: 24px; margin: 0; accent-color: var(--leaf); }
.month-choice input:checked + span { font-weight: 700; color: var(--leaf-dark); }
.problem-fields { border-top: 1px dashed var(--line); padding-top: 0.9rem; margin: 0.9rem 0 0; }
/* ------------------------------------------------------------ Weather ---- */

.frost-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid #b9cfdf;
  border-radius: var(--radius);
  background: var(--water-wash);
  color: var(--ink);
}
.frost-banner strong { color: var(--water); }
.frost-icon { font-size: 1.5rem; line-height: 1; }
.forecast { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: 0.5rem; }
.forecast-day { display: grid; gap: 0.15rem; align-content: start; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.forecast-name { font-weight: 700; }
.forecast-emoji { font-size: 1.6rem; line-height: 1.2; }
.forecast-label, .forecast-rain { font-size: 0.85rem; color: var(--muted); }
.forecast-temp { font-size: 1.05rem; }
.weather-now { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.weather-big { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.25; color: var(--leaf-dark); }
.weather-big .muted { font-size: 1.1rem; }

/* ------------------------------------------------------- Plant labels ---- */
/* Sized in millimetres for A4 (see print.css); on narrow screens they stack. */

.label-sheet { display: grid; gap: 3mm; justify-content: start; }
.label-sheet-stake { grid-template-columns: repeat(2, minmax(0, 92mm)); }
.label-sheet-small { grid-template-columns: repeat(3, minmax(0, 60mm)); }
.plant-label {
  display: flex;
  align-items: center;
  gap: 3mm;
  background: #fff;
  color: #000;
  border: 0.3mm dashed #8c8274;
  border-radius: 3mm;
  padding: 4mm;
  break-inside: avoid;
  page-break-inside: avoid;
}
.label-sheet-stake .plant-label { height: 62mm; }
.label-sheet-small .plant-label { height: 38mm; padding: 3mm; gap: 2mm; }
.plant-label-text { flex: 1 1 auto; min-width: 0; }
.plant-label-name { font-family: var(--font-display); font-weight: 700; font-size: 7mm; line-height: 1.1; margin: 0 0 1.5mm; overflow-wrap: anywhere; }
.label-sheet-small .plant-label-name { font-size: 4.2mm; }
.plant-label-kind, .plant-label-meta { font-size: 3.2mm; margin: 0 0 1mm; }
.label-sheet-small .plant-label-kind { font-size: 2.8mm; }
.plant-label-link { font-size: 2.6mm; color: #333; margin: 1.5mm 0 0; overflow-wrap: anywhere; }
.plant-label-qr { flex: none; width: 32mm; height: 32mm; }
.label-sheet-small .plant-label-qr { width: 25mm; height: 25mm; }
.plant-label-qr svg { display: block; width: 100%; height: 100%; }
@media screen and (max-width: 47.99rem) {
  .label-sheet-stake, .label-sheet-small { grid-template-columns: minmax(0, 92mm); }
}

/* -------------------------------------------------- Classroom display ---- */

.display { width: 100%; padding: clamp(1rem, 2vw, 2rem); max-width: 2000px; margin: 0 auto; font-size: clamp(1rem, 0.5rem + 0.75vw, 1.35rem); }
.display-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.display-head h1 { font-size: clamp(1.8rem, 1rem + 2.5vw, 3.2rem); margin: 0; }
.display-head p { margin: 0.2rem 0 0; color: var(--muted); }
.display-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.display-grid { display: grid; gap: clamp(0.75rem, 1.5vw, 1.5rem); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.display-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 1.5vw, 1.75rem); }
.display-card h2 { font-size: 1.3em; margin: 0 0 0.6rem; }
.display-card p { margin: 0 0 0.5rem; }
.display-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.display-quiet { color: var(--muted); }
.display-big { font-family: var(--font-display); font-size: 2em; line-height: 1.1; margin: 0.1rem 0; color: var(--leaf-dark); }
.display-weather { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 0.5rem; }
.display-weather p { margin: 0; }
.display-photo { margin: 0 0 0.75rem; }
.display-photo img { display: block; width: 100%; max-height: 30vh; object-fit: cover; border-radius: var(--radius-sm); }
.display-photo figcaption { color: var(--muted); font-size: 0.85em; margin-top: 0.35rem; }
.display-foot { color: var(--muted); font-size: 0.8em; margin-top: 1rem; text-align: center; }
.display-diary-body { display: grid; gap: 1rem; }
/* Whiteboards: three columns, the diary two wide with its photo beside the entries. */
@media (min-width: 75rem) {
  .display-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .display-diary { grid-column: span 2; }
  .display-diary-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .display-diary-body .display-photo { margin: 0; }
}
html.display-dark body { background: #121a14; color: #e8efe6; }
html.display-dark .display-card { background: #1b261e; border-color: #2c3b30; }
html.display-dark .display-head p,
html.display-dark .display-quiet,
html.display-dark .display-foot,
html.display-dark .display-photo figcaption { color: #a9b8a8; }
html.display-dark .display-big,
html.display-dark h1,
html.display-dark h2 { color: #bfe3c1; }
html.display-dark .button-secondary { background: transparent; color: #e8efe6; border-color: #4a5e4d; }
html.display-dark .frost-banner { background: #1d2c3a; border-color: #35506a; color: #e8efe6; }
html.display-dark .frost-banner strong { color: #bcd6ee; }

/* ------------------------------------------------- Pupils' dashboard ---- */

.countdown-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.countdown { display: flex; gap: 0.85rem; align-items: center; }
.countdown h3 { font-size: 1.05rem; margin: 0; }
.countdown .meta { margin: 0.1rem 0 0.35rem; }
.countdown-days { flex: none; min-width: 4.2rem; text-align: center; padding: 0.4rem 0.5rem; border-radius: var(--radius-sm); background: var(--leaf-wash); color: var(--leaf-dark); line-height: 1.1; font-size: 0.8rem; }
.countdown-days strong { display: block; font-family: var(--font-display); font-size: 1.5rem; }
.countdown-days.is-now { background: var(--leaf); color: #fff; }

/* -------------------------------------------------------------- Diary ---- */

.choice-row { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-entry { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.log-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.log-icon { flex: none; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--leaf-wash); font-size: 1rem; }
.log-body { flex: 1 1 auto; min-width: 0; }
.log-title { margin: 0; }
.log-body .meta { margin: 0.1rem 0 0; }
.log-text { margin: 0.4rem 0 0; white-space: pre-line; }
.log-photo { display: inline-block; margin-top: 0.5rem; }
.log-photo img { display: block; max-width: min(100%, 240px); height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 1rem; }
.photo-grid img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 0.35rem; }

/* Growth chart (lib/growthChart.js): two sizes, one shown. */
.growth-chart { margin: 0 0 1rem; }
.growth-title { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 0.25rem; }
.gc-svg { display: block; width: 100%; height: auto; overflow: visible; }
.gc-wide { display: none; }
@media (min-width: 40rem) {
  .gc-narrow { display: none; }
  .gc-wide { display: block; max-width: 640px; }
}
.gc-grid { stroke: rgba(107, 98, 87, 0.18); stroke-width: 1; shape-rendering: crispEdges; }
.gc-tick { fill: var(--muted); font-family: var(--font-body); font-size: 11px; font-variant-numeric: tabular-nums; }
.gc-area { fill: var(--leaf); fill-opacity: 0.1; }
.gc-line { fill: none; stroke: var(--leaf); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gc-dot { fill: var(--leaf); stroke: var(--paper); stroke-width: 2; pointer-events: none; }
.gc-hit { fill: transparent; cursor: default; }
.gc-point:hover .gc-dot { fill: var(--leaf-dark); }
.gc-end { fill: var(--ink); font-family: var(--font-body); font-size: 12px; font-weight: 600; }
.gc-table summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--leaf-dark); font-weight: 600; }

/* Waiting for Claude's guide draft. */
.drafting { display: flex; gap: 0.75rem; align-items: flex-start; margin: 0.5rem 0 1rem; }
.drafting p { margin: 0; }
.drafting-dot { flex: none; width: 14px; height: 14px; margin-top: 0.35rem; border-radius: 50%; background: var(--leaf); animation: drafting-pulse 1.2s ease-in-out infinite; }
@keyframes drafting-pulse { 0%, 100% { opacity: 0.25; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .drafting-dot { animation: none; } }

.field-error { color: var(--danger-ink); font-size: 0.9rem; font-weight: 600; margin: 0.4rem 0 0; }
.field-error:empty { display: none; }

/* Plant picker on the add page (public/js/picker.js; a drop-down without JS). */
.picker-search { margin-bottom: 0.6rem; }
.picker-scroll { max-height: min(26rem, 60vh); overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.picker-group + .picker-group { margin-top: 0.75rem; }
.picker-group-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; margin: 0 0 0.35rem; }
.picker-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: 6px; }
.picker-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.picker-tile:hover { background: var(--leaf-wash); }
.picker-tile[aria-pressed="true"] { border-color: var(--leaf); background: var(--leaf-wash); box-shadow: inset 0 0 0 1px var(--leaf); font-weight: 600; }
.picker-tile-emoji { font-size: 1.3rem; line-height: 1; flex: none; }
.picker-tile-new { border-style: dashed; color: var(--leaf-dark); margin-top: 0.6rem; }
.picker-empty { margin-top: 0.5rem; }
.picker-chosen {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  border: 1px solid var(--leaf);
  border-radius: var(--radius-sm);
  background: var(--leaf-wash);
}
.picker-chosen-emoji { font-size: 1.6rem; line-height: 1; }
.picker-chosen-name { flex: 1 1 auto; font-weight: 600; }
.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: var(--tap);
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.choice-chip:hover { background: var(--leaf-wash); }
@media (min-width: 640px) {
  .month-picker-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

.error-list {
  background: var(--danger-wash);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem 0.75rem 2rem;
  margin: 0 0 1.2rem;
  color: var(--danger-ink);
  font-size: 0.92rem;
}
.error-list li + li { margin-top: 0.25rem; }

/* -------------------------------------------------------------- Flash ---- */

.flash-stack { display: grid; gap: 0.6rem; margin-bottom: 1.25rem; }
.flash {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--leaf-light);
  background: var(--leaf-wash);
  color: var(--leaf-dark);
  font-size: 0.94rem;
}
.flash p { margin: 0; }
.flash-error { background: var(--danger-wash); border-color: var(--danger-line); color: var(--danger-ink); }

.notice {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px dashed var(--line-strong);
  font-size: 0.92rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- Badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--leaf-wash);
  color: var(--leaf-dark);
  white-space: nowrap;
}
.badge-harvest { background: var(--harvest-wash); color: var(--harvest-ink); }
.badge-water { background: var(--water-wash); color: var(--water); }
.badge-overdue { background: var(--accent-wash); color: var(--accent); }
.badge-quiet { background: rgba(107, 98, 87, 0.1); color: var(--muted); }
a.badge { min-height: 28px; text-decoration: none; }
a.badge:hover { filter: brightness(0.95); }

/* ----------------------------------------------------------- Progress ---- */

progress.progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: rgba(107, 98, 87, 0.14);
  overflow: hidden;
  color: var(--leaf);
}
progress.progress::-webkit-progress-bar { background: rgba(107, 98, 87, 0.14); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--leaf-light), var(--leaf)); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--leaf-light), var(--leaf)); border-radius: 999px; }
progress.progress.is-ready::-webkit-progress-value { background: linear-gradient(90deg, var(--harvest), var(--accent)); }
progress.progress.is-ready::-moz-progress-bar { background: linear-gradient(90deg, var(--harvest), var(--accent)); }
.progress-narrow { max-width: 26rem; }

/* -------------------------------------------------------- Plant cards ---- */

.plant-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
a.plant-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); color: inherit; }
.plant-card.is-finished { opacity: 0.8; }

.plant-card-top { display: flex; gap: 0.75rem; align-items: flex-start; }
.plant-emoji {
  font-size: 1.9rem;
  line-height: 1;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--leaf-wash);
  border-radius: 12px;
  flex: none;
}
.plant-emoji-sm { width: 36px; height: 36px; font-size: 1.3rem; border-radius: 10px; }
.plant-card h3 { margin: 0; font-size: 1.05rem; }
.latin { font-style: italic; color: var(--muted); font-size: 0.84rem; }
.meta { font-size: 0.86rem; color: var(--muted); margin: 0; }

.plant-row { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.45rem; }
.plant-row h3 { margin: 0; font-size: 1.05rem; }
.plant-row h3 a { color: inherit; text-decoration: none; }
.plant-row h3 a:hover { text-decoration: underline; }

.stat-row { display: flex; gap: 1rem 1.75rem; flex-wrap: wrap; }
.stat { min-width: 80px; }
/* Four headline numbers: 2 × 2 on phones, one row when there's room. */
.stat-row-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .stat-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat strong { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--leaf-dark); line-height: 1.1; }
.stat span { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* --------------------------------------------------------- Task lists ---- */

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list > li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--line);
  min-height: 56px;
}
.task-list > li:last-child { border-bottom: 0; }
.task-list > li.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-form { margin: 0; flex: none; }

/* A 44px tap target around a 28px circle. */
.task-check {
  flex: none;
  position: relative;
  width: var(--tap);
  height: var(--tap);
  margin-left: -8px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 0.85rem;
  font-weight: 700;
}
.task-check::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  left: 8px;
  top: 8px;
  border-radius: 50%;
  border: 2px solid var(--field-border);
  background: #fff;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.task-check > span { position: relative; }
.task-check:hover::before { border-color: var(--leaf); background: var(--leaf-wash); }
.task-check[aria-pressed="true"],
.task-check.is-on { color: #fff; }
.task-check[aria-pressed="true"]::before,
.task-check.is-on::before { background: var(--leaf); border-color: var(--leaf); }
.task-check.is-static { cursor: default; }
.task-check.is-static:hover::before { border-color: var(--field-border); background: #fff; }
.task-check.is-static.is-on:hover::before { background: var(--leaf); border-color: var(--leaf); }
.task-check[disabled] { cursor: progress; }

.task-body { flex: 1 1 auto; min-width: 0; padding: 0.3rem 0; }
.task-title { font-weight: 500; overflow-wrap: anywhere; }
.task-title a { color: inherit; }
.task-meta { font-size: 0.84rem; color: var(--muted); }

.empty-state { text-align: center; padding: 1.75rem 1rem; color: var(--muted); }
.empty-state .emoji { font-size: 2.2rem; display: block; margin-bottom: 0.5rem; }
.empty-note { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* ----------------------------------------------------- Notifications ---- */

.note-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.note-list.is-page { max-height: none; overflow: visible; }
.note-list li { border-bottom: 1px solid var(--line); }
.note-list li:last-child { border-bottom: 0; }
.note-item { display: block; padding: 0.75rem 0.9rem; text-decoration: none; color: inherit; }
.note-item:hover { background: var(--leaf-wash); color: inherit; }
.note-item.is-unread { border-left: 4px solid var(--accent); }
.note-item strong { display: block; font-size: 0.94rem; font-weight: 600; }
.note-item span { display: block; font-size: 0.86rem; color: var(--muted); }
.note-item time { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.note-empty { padding: 1.1rem 0.9rem; color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ---------------------------------------------------------- Calendar ----- */

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.calendar-head h2 { margin: 0; }

/* Phones get a list of the days that have something on. */
.cal-agenda { list-style: none; margin: 0; padding: 0; }
.cal-agenda > li { display: flex; gap: 0.85rem; padding: 0.75rem 0; border-bottom: 1px dashed var(--line); }
.cal-agenda > li:last-child { border-bottom: 0; }
.cal-agenda .cal-day {
  flex: none;
  width: 3.2rem;
  text-align: center;
  line-height: 1.1;
  padding-top: 0.15rem;
}
.cal-agenda .cal-day strong { display: block; font-family: var(--font-display); font-size: 1.45rem; color: var(--leaf-dark); }
.cal-agenda .cal-day span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cal-agenda li.is-today .cal-day strong { color: var(--accent); }
.cal-agenda .cal-events { flex: 1 1 auto; min-width: 0; display: grid; gap: 0.35rem; }
.cal-agenda .cal-event { white-space: normal; padding: 0.45rem 0.6rem; font-size: 0.9rem; min-height: 36px; display: flex; align-items: center; }

/* Tablets and up get the month grid, as a real table. */
.cal-table { display: none; width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; margin: -5px; width: calc(100% + 10px); }
.cal-table caption { text-align: left; }
.cal-table abbr[title] { text-decoration: none; }
.cal-table th {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.2rem;
}
.cal-table td {
  height: 108px;
  vertical-align: top;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.cal-table td.is-empty { background: transparent; border-color: transparent; }
.cal-table td.is-today { border-color: var(--leaf); box-shadow: 0 0 0 2px rgba(58, 125, 68, 0.2); }
.cal-table td.in-window { background: var(--harvest-wash); }
.cal-date { display: block; font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 0.15rem; }
.cal-table td.is-today .cal-date { color: var(--leaf-dark); }
.cal-table .cal-event + .cal-event { margin-top: 3px; }

.cal-event {
  display: block;
  min-height: 24px;
  font-size: 0.76rem;
  line-height: 1.35;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  background: var(--water-wash);
  color: var(--water);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.cal-event:hover { filter: brightness(0.96); color: var(--water); }
.cal-event.is-harvest { background: var(--harvest-wash); color: var(--harvest-ink); font-weight: 600; }
.cal-event.is-planted { background: var(--leaf-wash); color: var(--leaf-dark); }
.cal-event.is-done { opacity: 0.6; text-decoration: line-through; }
.cal-more { display: block; font-size: 0.74rem; color: var(--muted); margin-top: 2px; }

.legend { display: flex; gap: 0.5rem 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--muted); margin-top: 1rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch-water { background: var(--water-wash); }
.swatch-window { background: var(--harvest-wash); border: 1px solid var(--harvest); }
.swatch-planted { background: var(--leaf-wash); }
.swatch-today { border: 2px solid var(--leaf); }

@media (min-width: 768px) {
  .cal-agenda { display: none; }
  .cal-table { display: table; }
}

/* ------------------------------------------------------- Month strip ----- */

.month-strip { display: grid; gap: 0.5rem; }
.month-strip-row { display: grid; grid-template-columns: 1fr; gap: 0.2rem; align-items: center; }
.month-strip-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.month-cells { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.month-cell {
  height: 22px;
  border-radius: 4px;
  background: rgba(107, 98, 87, 0.08);
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  color: var(--muted);
}
.month-cell.is-label { background: transparent; height: auto; font-weight: 600; }
.month-cell.on-sow-in { background: #dfe9f2; color: var(--water); }
.month-cell.on-sow-out { background: var(--leaf-wash); color: var(--leaf-dark); }
.month-cell.on-plant { background: #cfe2cd; color: var(--leaf-dark); }
.month-cell.on-harvest { background: #f8e3b4; color: var(--harvest-ink); }
.month-cell.is-now { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (min-width: 640px) {
  .month-strip-row { grid-template-columns: 7.5rem 1fr; gap: 0.6rem; }
  .month-cell { height: 26px; }
}

/* ------------------------------------------------------------ Guides ----- */

.guide-hero { display: flex; gap: 1rem 1.25rem; align-items: flex-start; flex-wrap: wrap; }
.guide-hero .plant-emoji { font-size: 2.6rem; width: 68px; height: 68px; border-radius: 18px; }
.guide-hero-body { flex: 1 1 18rem; min-width: 0; }
.guide-hero-body h1 { margin-bottom: 0.1rem; }
.subtitle { color: var(--muted); margin: 0 0 0.75rem; }

.detail-list { display: grid; gap: 0.9rem; margin: 0; }
.detail-list dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.detail-list dd { margin: 0.15rem 0 0; }

.problem { padding: 0.9rem 0; border-bottom: 1px dashed var(--line); }
.problem:last-child { border-bottom: 0; padding-bottom: 0; }
.problem h3 { margin: 0 0 0.2rem; font-size: 1rem; color: var(--soil); }
.problem p { margin: 0 0 0.3rem; font-size: 0.94rem; }
.problem .symptoms { color: var(--muted); font-style: italic; }

/* ---------------------------------------------------- Photo features ----- */

/* Photo beside the verdict when there's room, stacked when there isn't —
   decided by the space available, not the screen width. */
.photo-result { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.photo-result > img {
  flex: 1 1 10rem;
  max-width: 16rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  display: block;
}
.photo-result > div { flex: 999 1 16rem; min-width: 0; }
.result-heading { font-size: 1.15rem; margin: 0 0 0.6rem; }
.h-small { font-size: 1rem; margin: 0.75rem 0 0.25rem; }
.result-heading:focus { outline: none; }

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.6rem;
}
.verdict-ready { background: var(--leaf); color: #fff; }
.verdict-nearly { background: var(--harvest-wash); color: var(--harvest-ink); }
.verdict-not-ready { background: var(--water-wash); color: var(--water); }
.verdict-unknown { background: rgba(107, 98, 87, 0.12); color: var(--muted); }

.photo-panel,
.more-panel {
  border: 1px dashed var(--field-border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--cream);
}
.photo-panel > summary,
.more-panel > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--leaf-dark);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.photo-status { font-size: 0.9rem; color: var(--leaf-dark); margin: 0.6rem 0 0; }
.photo-status:empty { display: none; }
.result-area:empty { display: none; }
.result-area { margin-top: 1rem; }

.problem-list { padding-left: 1.2rem; margin: 0.3rem 0 0.9rem; }
.problem-list li + li { margin-top: 0.35rem; }

/* --------------------------------------------------------- Auth pages ---- */

.auth-shell {
  min-height: calc(100vh - 12rem);
  min-height: calc(100dvh - 12rem);
  display: grid;
  place-items: center;
  padding: 1rem 0;
}
.auth-card {
  width: min(28rem, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 2vw, 2rem);
  box-shadow: var(--shadow-lift);
}
.auth-card h1 { text-align: center; margin-bottom: 0.2rem; }
.auth-lede { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: 0.96rem; }

.error-card { max-width: 35rem; margin: 2rem auto; text-align: center; }
.error-card .button-row { justify-content: center; }

.danger-zone { border-color: var(--danger-line); background: #fffaf9; }
.finished-panel { border-color: var(--harvest); background: var(--harvest-wash); }

/* ------------------------------------------------------------- Admin ---- */

.subnav { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: -0.5rem 0 1.25rem; }
.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}
.subnav a:hover { background: var(--leaf-wash); }
.subnav a.is-active { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.stat-big { font-family: var(--font-display); font-size: 2rem; color: var(--leaf-dark); margin: 0.25rem 0 0.5rem; line-height: 1.1; }
.stat-big span { font-family: var(--font-body); font-size: 0.95rem; color: var(--muted); }
.table-scroll { overflow-x: auto; position: relative; } /* contains .visually-hidden cells */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.data-table th, .data-table td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.data-table tbody th { font-weight: 600; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.finished-panel h2 { color: var(--harvest-ink); }
