:root {
  color-scheme: light;
  --green: #2f7a4a;
  --green-dark: #1f5834;
  --green-darker: #16412a;
  --bg: #f6f5f0;
  --ink: #1c1c1a;
  --muted: #6b6b63;
  --card: #ffffff;
  --overdue: #d3452f;
  --needs-water: #e0a52c;
  --fine: #2f7a4a;
  --unknown: #8a8a80;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.icon-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid #e7e5dc;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Wizard chrome: replaces the topbar during the new-terrace setup flow
   (scan → add missed plants → identify) so it reads as one immersive,
   full-screen sequence with its own step title and progress, like a
   typical onboarding wizard, rather than a page with the normal app nav
   still visible around it. */
.wizard-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e7e5dc;
}

.wizard-step-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.wizard-step-title {
  margin: 2px 0 10px;
  font-size: 1.05rem;
}

.wizard-progress {
  height: 5px;
  border-radius: 999px;
  background: #eeece2;
  overflow: hidden;
}

.wizard-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green-dark);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* While the wizard is active: hide the normal topbar/nav and the
   terrace-picking chrome that isn't relevant mid-setup, and let the main
   content use the full width for a more immersive feel. */
body.wizard-mode .topbar {
  display: none;
}

body.wizard-mode #terrace-switcher,
body.wizard-mode .terrace-header {
  display: none;
}

body.wizard-mode main {
  padding-top: 12px;
}

.view-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 999px;
  padding: 3px;
}

.view-tab {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.view-tab.active {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

@media (max-width: 420px) {
  .topbar h1 .title-text {
    display: none;
  }

  .view-tab {
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .upload-btn {
    padding: 8px 10px;
    font-size: 0.72rem;
  }

  .topbar-actions {
    gap: 6px;
  }
}

.upload-btn {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  outline: none;
  font-family: inherit;
  background: var(--green-dark);
  color: white;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}

.upload-btn:active {
  background: var(--green-darker);
}

.upload-btn-block {
  display: block;
  text-align: center;
  margin-bottom: 6px;
}

.upload-btn-secondary {
  background: #eeece2;
  color: var(--ink);
  border: 2px solid #d8d4c4;
}

.upload-btn-secondary:active {
  background: #e2ded0;
}

main {
  padding: 16px;
  padding-bottom: max(32px, calc(env(safe-area-inset-bottom, 0px) + 28px));
  max-width: 640px;
  margin: 0 auto;
}

.empty-state {
  text-align: center;
  margin-top: 20vh;
  color: var(--muted);
}

.empty-state p:first-child {
  font-size: 1.1rem;
  color: var(--ink);
  font-weight: 600;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 10px;
}

.canvas-wrap {
  display: flex;
  flex-direction: column;
}

.terrace-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.terrace-switcher-thumb {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid transparent;
  padding: 0;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-color: #ddd;
}

.terrace-switcher-thumb.active {
  border-color: var(--green);
}

.terrace-switcher-add {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  border: 2px dashed #c8c4b6;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.terrace-header {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.terrace-name-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  padding: 4px 2px;
  border-radius: 8px;
}

.terrace-name-input:focus {
  background: white;
  outline: 2px solid var(--green);
}

.terrace-delete-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  cursor: pointer;
}

.terrace-delete-btn:active {
  background: #fbe4e0;
  color: var(--overdue);
}

.photo-stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: #ddd;
  touch-action: manipulation;
}

/* While actively tracing a freehand shape, a one-finger drag must draw
   instead of scrolling the page. */
.photo-stage.draw-active {
  touch-action: none;
}

.photo-stage img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.pin-layer {
  position: absolute;
  inset: 0;
}

.pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.pin-dot {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3.5px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 1.5px rgba(0, 0, 0, 0.15);
  background: var(--unknown);
}

.pin[data-status="fine"] .pin-dot { background: var(--fine); }
.pin[data-status="needs_water"] .pin-dot { background: var(--needs-water); }
.pin[data-status="overdue"] .pin-dot { background: var(--overdue); }
.pin[data-status="unknown"] .pin-dot { background: var(--unknown); }

.pin-label {
  margin-top: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  background: rgba(0, 0, 0, 0.55);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sequence number shown inside a plain (non-outlined) pin's dot while it
   still needs identification — replaces the empty dot / old "?" glyph. */
.pin-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
}

.pin-flag {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--overdue);
  background: white;
  border-radius: 50%;
  padding: 3px;
  display: flex;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.pin-outline-shape {
  fill: rgba(127, 217, 154, 0.24);
  stroke: white;
  stroke-width: 2;
  cursor: pointer;
  pointer-events: auto;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.pin-outline-shape[data-status="fine"] { stroke: var(--fine); }
.pin-outline-shape[data-status="needs_water"] { stroke: var(--needs-water); fill: rgba(224, 165, 44, 0.22); }
.pin-outline-shape[data-status="overdue"] { stroke: var(--overdue); fill: rgba(211, 69, 47, 0.22); }
.pin-outline-shape[data-status="unknown"] { stroke: var(--unknown); }

/* Badge on each still-pending outlined plant showing its number (or, during
   the dedicated identification stage, its guess confidence %) — tapping it
   jumps into the identify flow. Once identified, the outline and this badge
   disappear entirely in favor of a plain numbered pin (see .pin-number). */
.pin-outline-badge {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  background: white;
  color: var(--needs-water);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px var(--needs-water);
  transition: left 0.35s ease, top 0.35s ease;
}

/* --- Terrace processing: scanning + digital-art stylization moment --- */

.terrace-processing {
  display: flex;
  flex-direction: column;
}

.processing-stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: #ddd;
}

.processing-stage img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.78) brightness(0.93);
}

.processing-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(127, 217, 154, 0.22), transparent);
  filter: blur(10px);
  animation: scan-sweep 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes scan-sweep {
  0% { top: -45%; opacity: 0; }
  20% { opacity: 1; }
  50% { top: 55%; opacity: 1; }
  80% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* Preview shown while choosing auto-detect vs manual — a clean, undistorted
   look at the picked photo, no scan shimmer since scanning hasn't started. */
.terrace-processing.picking .processing-scan {
  display: none;
}

.terrace-processing.picking .processing-stage img {
  filter: none;
}

/* Once detections come back, the shimmer's job is done — the segmentation
   reveal takes over as the "something is happening" signal. */
.terrace-processing.results-ready .processing-scan {
  display: none;
}

/* --- Segmentation overlay: instance-segmentation reveal after a scan --- */

.segmentation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.segmentation-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: 1;
}

.segment-shape {
  fill: rgba(127, 217, 154, 0.28);
  stroke: #eafff0;
  stroke-width: 2;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  animation: segment-fade-in 0.45s ease forwards;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.segment-shape:active {
  fill: rgba(127, 217, 154, 0.42);
}

/* Detections that only got a fallback circle (segmentation couldn't
   confidently trace them) — dashed and dimmer, a visual cue that these are
   the rougher ones worth a closer look before accepting. */
.segment-shape-fallback {
  stroke-dasharray: 4 3;
  fill-opacity: 0.55;
}

/* Review decisions — tap the shape itself (not a tiny target) to cycle
   pending → accepted → removed. */
.segment-shape[data-decision="accepted"] {
  fill: rgba(47, 122, 74, 0.55);
  stroke: #ffffff;
  stroke-width: 2.5;
  stroke-dasharray: none;
}

.segment-shape[data-decision="removed"] {
  fill: rgba(211, 69, 47, 0.12);
  stroke: rgba(211, 69, 47, 0.65);
  stroke-width: 2;
  stroke-dasharray: 3 3;
}

@keyframes segment-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.segment-marker {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%) scale(0);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-dark);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 2px white;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  animation: marker-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: left 0.35s ease, top 0.35s ease;
}

.segment-marker[data-decision="accepted"] {
  background: var(--fine);
  color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), 0 0 0 2px white;
}

.segment-marker[data-decision="removed"] {
  background: rgba(255, 255, 255, 0.92);
  color: var(--overdue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px var(--overdue);
}

@keyframes marker-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.processing-review-actions {
  margin-top: 12px;
}

.processing-review-actions .btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* --- Post-scan flow: top-up (add missed plants) + identification review --- */

.flow-actions {
  margin-top: 10px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.flow-actions .hint {
  margin-top: 0;
  margin-bottom: 10px;
}

.flow-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.flow-actions-row .btn {
  flex: 1;
}

.flow-actions .btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Freehand-polygon drawing tool: vertices + connecting lines as the user
   taps the photo, live, before the shape is finalized. */
.draw-vertex {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green-dark);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.draw-vertex-start {
  width: 16px;
  height: 16px;
  background: white;
  border: 2px solid var(--green-dark);
}

.draw-outline {
  fill: rgba(127, 217, 154, 0.28);
  stroke: var(--green-dark);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}

/* Confidence-percentage badge shown during the identification review step —
   reuses the same round tap-target as .pin-outline-badge but sized for
   two-to-three digit text instead of a single glyph. */
.pin-outline-badge.confidence-badge-marker {
  width: 34px;
  height: 34px;
  font-size: 0.68rem;
  background: white;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 2px var(--green-dark);
}

.processing-stage-fade-in {
  animation: stage-fade-in 0.4s ease both;
}

@keyframes stage-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}

.dialog {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  border-radius: 18px 18px 0 0;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.dialog h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.dialog-scroll {
  max-height: 85vh;
  overflow-y: auto;
}

.dialog label:not(.upload-btn) {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 12px;
}

.dialog label:first-of-type {
  margin-top: 0;
}

.dialog input[type="text"],
.dialog input[type="number"],
.dialog select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ddd9cd;
  font-size: 1rem;
}

.confirm-photo {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 6px;
  background: #ddd;
}

.confidence-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eeece2;
  color: var(--muted);
  margin-left: 4px;
}

.confidence-badge[data-level="high"] { background: var(--green-dark); color: white; }
.confidence-badge[data-level="medium"] { background: var(--needs-water); color: #3a2a06; }
.confidence-badge[data-level="low"] { background: var(--overdue); color: white; }

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  font-family: inherit;
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--green-dark);
  color: white;
}

.btn-primary:active {
  background: var(--green-darker);
}

.btn-ghost {
  background: #eeece2;
  color: var(--ink);
}

.btn-small {
  flex: none;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.auth-view {
  display: flex;
  justify-content: center;
  margin-top: 12vh;
  padding: 0 20px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ddd9cd;
  font-size: 1rem;
  font-family: inherit;
}

.auth-error {
  background: #fbe9e6;
  color: var(--overdue);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.auth-toggle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 16px 0 0;
}

.link-btn {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: var(--green-dark);
  cursor: pointer;
  padding: 0 0 0 4px;
}

.btn-danger {
  background: #fbe4e0;
  color: var(--overdue);
}

.btn-water {
  width: 100%;
  background: var(--green-dark);
  color: white;
  margin-top: 4px;
}

.btn-water:active {
  background: var(--green-darker);
}

.btn-ai {
  background: #eef0fb;
  color: #3d3a8a;
  border: 2px solid #c7c9ef;
}

.btn-ai:active {
  background: #dfe1f6;
}

.status-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  color: white;
  background: var(--unknown);
}

.status-badge[data-status="fine"] { background: var(--fine); color: white; }
.status-badge[data-status="needs_water"] { background: var(--needs-water); color: #3a2a06; }
.status-badge[data-status="overdue"] { background: var(--overdue); color: white; }
.status-badge[data-status="unknown"] { background: var(--unknown); color: #232320; }

.flag-note {
  color: #b5791f;
  font-weight: 600;
}

/* --- Today view: swipeable task stack --- */

.today-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.task-stack {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 520px;
}

.task-card {
  position: absolute;
  inset: 0;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: none;
  will-change: transform;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.task-card.dragging {
  transition: none;
}

.task-card-photo {
  flex: 1;
  background-size: cover;
  background-position: center;
  background-color: #d8e3da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.task-card-body {
  padding: 16px 18px;
  background: var(--card);
}

.task-card-body h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.task-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.task-card-profile-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #eeece2;
  color: var(--muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.task-card-profile-btn:active {
  background: #e2ded0;
}

.task-card-prompt {
  margin: 0 0 6px;
  font-weight: 600;
}

.task-card-reason {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.swipe-hint {
  position: absolute;
  top: 24px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 3px solid;
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.swipe-hint-right {
  right: 20px;
  color: var(--fine);
  border-color: var(--fine);
  transform: rotate(8deg);
}

.swipe-hint-left {
  left: 20px;
  color: var(--overdue);
  border-color: var(--overdue);
  transform: rotate(-8deg);
}

.swipe-hint-up {
  left: 50%;
  transform: translateX(-50%);
  color: #8a6d1f;
  border-color: #8a6d1f;
}

.task-actions {
  display: flex;
  gap: 18px;
  margin-top: 20px;
}

.task-action-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  font-size: 1.4rem;
  cursor: pointer;
}

.task-action-water {
  background: #eaf2ec;
}

.task-action-flag {
  background: #fbf1de;
}

.today-overview {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.today-queue {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.queue-back-btn {
  align-self: flex-start;
  margin-bottom: 10px;
}

.queue-reschedule-link {
  margin-top: 10px;
}

.queue-datepicker {
  width: 100%;
  max-width: 380px;
  margin-top: 10px;
}

.weather-banner {
  background: #fbf1de;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.weather-banner #weather-temp {
  font-weight: 700;
  margin-right: 4px;
}

.today-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.today-task-groups {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.today-task-group-heading {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.today-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  margin-bottom: 8px;
  cursor: pointer;
}

.today-task-row-photo {
  cursor: pointer;
}

.today-task-row-body {
  flex: 1;
  min-width: 0;
}

.today-task-row-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.today-task-row-reason {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.today-task-row-datepicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.today-task-date-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d8d4c4;
}

.today-task-row-datepicker .btn {
  flex: none;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.today-task-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.today-task-action {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.today-task-done {
  background: #eaf2ec;
  color: var(--fine);
}

.today-task-remove:active {
  background: #fbe4e0;
  color: var(--overdue);
}

.hc-circle-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  font-size: 2.5rem;
}

/* --- Plants view: flat list across all terraces --- */

.plants-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.plant-row-photo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #d8e3da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.plant-row-body {
  flex: 1;
  min-width: 0;
}

.plant-row-name {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plant-row-terrace {
  font-size: 0.75rem;
  color: var(--muted);
}

.plant-row-flag {
  flex: 0 0 auto;
  font-size: 0.9rem;
  color: var(--overdue);
  display: flex;
}

.plant-row-delete {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.plant-row-delete:active {
  background: #fbe4e0;
  color: var(--overdue);
}

/* Banner shown when Plants is scoped to a single terrace (landed here right
   after a scan's identify flow finishes) rather than showing everything. */
.plants-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 8px 2px;
  font-size: 0.82rem;
  color: var(--muted);
}

.link-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  color: var(--green-dark);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
}

/* --- Identify review: full-screen approval list after the map preview --- */

.identify-review h2 {
  margin: 4px 0 2px;
}

.identify-review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.review-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.review-row-photo {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-color: #d8e3da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.review-row-body {
  flex: 1;
  min-width: 0;
}

.review-row-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.review-row-species {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
}

.review-row-guess-pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f3f1e6;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

.review-row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.review-row-actions .btn {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.pill {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
  align-self: center;
}

.pill-added {
  background: #e6f2e9;
  color: var(--green-dark);
}

.review-deferred-section {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed #ddd9cd;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-deferred-heading {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.review-row-deferred {
  opacity: 0.9;
}

/* --- Health view: score list + detail/diagnosis dialogs --- */

.health-list-score {
  flex: 0 0 auto;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.band-badge {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  color: white;
  background: var(--unknown);
}

.band-badge[data-band="great"] { background: var(--fine); }
.band-badge[data-band="ok"] { background: var(--unknown); color: #232320; }
.band-badge[data-band="struggling"] { background: var(--needs-water); color: #3a2a06; }
.band-badge[data-band="critical"] { background: var(--overdue); }

.health-photo-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-color: #d8e3da;
  font-size: 1.8rem;
}

.health-score-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.health-score-big {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}

.health-score-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.health-score-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 5px;
}

.health-score-row-label {
  font-weight: 700;
  flex: 1;
}

.health-score-row-value {
  color: var(--muted);
  font-size: 0.8rem;
}

.health-score-bar {
  height: 7px;
  border-radius: 999px;
  background: #eeece2;
  overflow: hidden;
}

.health-score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green-dark);
}

.health-cta-area {
  margin-top: 18px;
}

.health-cta-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 8px 0;
}

.diag-progress-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3d3a8a;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.diag-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0 4px;
}

.diag-choice {
  text-align: left;
}

.diag-notes-textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 90px;
  border-radius: 10px;
  border: 1px solid #ddd9cd;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-top: 10px;
}

.diag-loading {
  text-align: center;
  padding: 24px 0 8px;
}

.diag-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid #e6e5f2;
  border-top-color: #3d3a8a;
  margin: 0 auto;
  animation: diag-spin 0.9s linear infinite;
}

@keyframes diag-spin {
  to { transform: rotate(360deg); }
}

.diag-confidence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eef0fb;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #3d3a8a;
}

.diag-reason-list {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.diag-reason-list li {
  display: flex;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.diag-reason-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3d3a8a;
  margin-top: 7px;
  flex-shrink: 0;
}

.careplan-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.careplan-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.careplan-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #d8d4c4;
  color: white;
}

.careplan-check.checked {
  border: none;
  background: var(--green-dark);
}

.careplan-text {
  font-size: 0.9rem;
  line-height: 1.4;
}

.careplan-text.checked {
  color: var(--muted);
  text-decoration: line-through;
}

/* --- Home view: dashboard summary --- */

.home-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-greeting-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.home-greeting-title {
  margin: 2px 0 0;
  font-size: 1.5rem;
}

.home-weather-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eaf2ec;
  border-radius: var(--radius);
  padding: 12px 14px;
}

.home-weather-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-dark);
  flex-shrink: 0;
}

.home-weather-temp {
  font-weight: 700;
  font-size: 1rem;
}

.home-weather-note {
  font-size: 0.8rem;
  color: var(--green-darker);
  margin-top: 1px;
}

.home-stats-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
}

.home-stat-card {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  font-family: inherit;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  text-align: center;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.home-plants-card {
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 10px;
  padding: 10px 12px;
}

.home-gauge {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-gauge-inner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.home-stat-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eaf2ec;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-stat-number {
  font-weight: 800;
  font-size: 1.1rem;
}

.home-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.home-streak-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  padding: 14px 16px;
}

.home-streak-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fbf1de;
  color: #8a6d1f;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-streak-body {
  flex: 1;
  min-width: 0;
}

.home-streak-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.home-streak-number {
  font-weight: 800;
  font-size: 1.3rem;
}

.home-streak-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.home-streak-days {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.home-streak-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eeece2;
  color: var(--muted);
}

.home-streak-dot.done {
  background: var(--green-dark);
  color: white;
}

.home-cta-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-cta {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  text-align: left;
}

.home-cta-tasks {
  background: var(--green-dark);
}

.home-cta-attention {
  background: #b5591f;
}

.home-cta-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-cta-body {
  flex: 1;
  min-width: 0;
}

.home-cta-title {
  font-weight: 700;
  font-size: 1rem;
}

.home-cta-sub {
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: 1px;
}

/* --- Plant Profile: full-screen view combining status, watering, health,
   and upcoming care for a single plant --- */

.profile-view {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: -16px -16px 0;
  padding-bottom: 8px;
}

.profile-back-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-hero {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background-color: #d8e3da;
}

.profile-hero-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: var(--muted);
}

.profile-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 28, 26, 0.32) 0%, transparent 30%, transparent 70%, rgba(28, 28, 26, 0.38) 100%);
  pointer-events: none;
}

.profile-hero-caption {
  position: absolute;
  bottom: 10px;
  left: 14px;
  z-index: 1;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  background: rgba(28, 28, 26, 0.55);
  padding: 3px 10px;
  border-radius: 999px;
}

.profile-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 16px 2px;
}

.profile-thumb,
.profile-thumb-add {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-color: #d8e3da;
  border: 2px solid transparent;
}

.profile-thumb.active {
  border-color: var(--green);
}

.profile-thumb-add {
  border: 2px dashed #c8c4b6;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-header {
  padding: 8px 16px 0;
}

.profile-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.profile-name {
  margin: 0;
  font-size: 1.3rem;
}

.profile-confidence-badge {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--green-dark);
  color: white;
  white-space: nowrap;
}

.profile-species {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--muted);
  margin-top: 2px;
}

.profile-tags {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tag-flag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fbe4e0;
  color: var(--overdue);
}

.profile-card {
  margin: 12px 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.profile-card-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.profile-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-watering-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.profile-water-btn {
  width: 100%;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.profile-flag-btn {
  width: 100%;
  margin-top: 8px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
}

.profile-field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.profile-field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #ddd9cd;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
}

.profile-health-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.profile-gauge {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-gauge-inner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
}

.profile-subrows {
  flex: 1;
  min-width: 0;
}

.profile-health-cta {
  margin-top: 14px;
}

.profile-upcoming-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg);
  margin-top: 8px;
}

.profile-upcoming-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-upcoming-label {
  font-size: 0.85rem;
  font-weight: 700;
}

.profile-upcoming-when {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}

.profile-about-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #efece0;
  font-size: 0.85rem;
}

.profile-about-row:last-child {
  border-bottom: none;
}

.profile-about-label {
  color: var(--muted);
  flex-shrink: 0;
}

.profile-about-value {
  text-align: right;
  color: var(--ink);
}

.profile-registered {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--muted);
}

.profile-delete-btn {
  margin: 16px 16px 4px;
}

@media (max-width: 460px) {
  .view-tabs {
    gap: 1px;
  }

  .view-tab {
    padding: 6px 6px;
    font-size: 0.68rem;
  }
}
