/* - Reset & base - */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #ffffff;
  --surface:   #f7f8f4;
  --border:    #d8e0c8;
  --text:      #1f2318;
  --muted:     #5a6650;
  --accent:    #4a7c3f;
  --accent-dk: #345a2d;
  --danger:    #c0392b;
  --done:      #a8b89a;
  --radius:    8px;
  --shadow:    0 1px 4px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* - Header - */
.site-header {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.site-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}
.site-title:hover { text-decoration: none; opacity: .9; }

.site-nav { display: flex; align-items: center; gap: .5rem; }
.site-nav .btn-ghost { color: #fff; }
.site-nav .btn-ghost:hover { background: rgba(255,255,255,.15); }
.nav-user  { font-size: .85rem; opacity: .85; }

/* - Footer - */
.site-footer {
  margin-top: auto;
  text-align: center;
  padding: 1.25rem;
  font-size: .75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* - Main content - */
.site-main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* - Buttons - */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .45rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { background: var(--surface); text-decoration: none; }

.btn-primary  { background: var(--accent);  border-color: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

.btn-ghost  { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; border-color: #a93226; }

.btn-sm  { padding: .3rem .75rem; font-size: .8rem; }
.btn-xs  { padding: .15rem .5rem; font-size: .75rem; }

/* - Badges - */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-green { background: #d4edda; color: #276036; }
.badge-locked { background: #fde8e6; color: var(--danger); }

/* - Alerts - */
.alert { padding: .6rem .9rem; border-radius: var(--radius); font-size: .9rem; }
.alert-error { background: #fde8e6; color: var(--danger); border: 1px solid #f5c0ba; }
.alert-success { background: #e5f2e1; color: #345a2d; border: 1px solid #c3d9b8; }

/* - Page header - */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.6rem; line-height: 1.2; }
.page-header-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* - All plants page - */
.plant-sort-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .85rem;
}
.plant-sort-form select {
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.plant-directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.plant-directory-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.plant-directory-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,.13);
  text-decoration: none;
}
.plant-directory-image {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.plant-directory-image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8ede2;
  color: var(--muted);
  font-size: .85rem;
}
.plant-directory-card-body {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .8rem;
}
.plant-directory-card h2 {
  font-size: 1rem;
  line-height: 1.3;
}
.plant-directory-card p,
.plant-directory-card span {
  color: var(--muted);
  font-size: .82rem;
}

/* - Zone grid - */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.zone-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
}
.zone-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,.13); text-decoration: none; }

.zone-card-img {
  height: 160px;
  background-size: cover;
  background-position: center;
}
.zone-card-img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8ede2;
  color: var(--muted);
  font-size: .85rem;
}

.zone-card-body { padding: .9rem; flex: 1; }
.zone-card-name { font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.zone-card-desc { font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.zone-card-stats { margin-top: .4rem; }

/* - Zone page sections - */
.breadcrumb { font-size: .85rem; color: var(--muted); display: block; margin-bottom: .25rem; }
.zone-desc  { color: var(--muted); margin-top: .25rem; }

.zone-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.section-header h2 { font-size: 1.1rem; }

/* Keep the plant list beside the map so cards can be dragged straight onto it. */
.zone-plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.zone-plan-layout > .zone-section { min-width: 0; margin-bottom: 0; }
.zone-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.zone-photo-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.zone-photo-card > a { display: block; }
.zone-photo-image {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
}
.zone-photo-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  color: var(--muted);
  font-size: .78rem;
}
.zone-plant-grid { grid-template-columns: minmax(0, 1fr); }
.zone-plan-layout > .zone-section:nth-child(2) > .zone-plant-panel > .section-header {
  align-items: flex-start;
  flex-direction: column;
}
.zone-plant-tabs {
  display: flex;
  gap: .25rem;
  margin: -.25rem 0 1rem;
  border-bottom: 1px solid var(--border);
}
.zone-plant-tab {
  padding: .45rem .65rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.zone-plant-tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent-dk);
  font-weight: 600;
}
.zone-plant-panel[hidden] { display: none; }
.zone-plant-panel-hint {
  margin: 0 0 .65rem;
  color: var(--muted);
  font-size: .82rem;
}
.zone-existing-plant-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  list-style: none;
}
.zone-existing-plant {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  padding: .4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.zone-existing-plant-image {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 4px;
  object-fit: cover;
}
.zone-existing-plant-image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8ede2;
  font-size: 1.1rem;
}
.zone-existing-plant-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: .85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* - Zone image / pinboard - */
.zone-image-placeholder {
  width: 100%;
  height: 220px;
  background: #e8ede2;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
}

/* Pinboard container — positions pins absolutely over the image */
.pinboard {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-bottom: .75rem;
  border-radius: var(--radius);
  overflow: visible;
}
.pinboard > img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  user-select: none;
}

@media (max-width: 800px) {
  .zone-plan-layout { grid-template-columns: minmax(0, 1fr); }
  .zone-plan-layout > .zone-section:nth-child(2) > .zone-plant-panel > .section-header {
    align-items: center;
    flex-direction: row;
  }
}
.pinboard--over > img,
.pinboard--over .zone-image-placeholder {
  outline: 3px dashed var(--accent);
  outline-offset: 3px;
}

.pinboard-hint {
  position: absolute;
  bottom: .6rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: .75rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .2s;
}

/* - Map pins - */
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}
.map-pin--draggable { cursor: grab; }
.map-pin--moving    { cursor: grabbing; z-index: 20; }

/* The diamond-shaped pin label; text counter-rotates so it reads normally */
.map-pin-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  font-size: .78rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  flex-shrink: 0;
  line-height: 1;
}
/* Counter-rotate the text inside the diamond so it reads upright */
.map-pin-label > span { display: block; transform: rotate(45deg); }

/* Tooltip that appears on hover */
.map-pin-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + .5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .6rem;
  min-width: 130px;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
  white-space: nowrap;
  z-index: 30;
  flex-direction: row;
  align-items: center;
  gap: .4rem;
}
.map-pin:hover .map-pin-tooltip { display: flex; }
.map-pin-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}
.map-pin-name:hover { color: var(--accent); text-decoration: underline; }
.map-pin-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: .8rem;
  padding: 0 .15rem;
  line-height: 1;
  flex-shrink: 0;
}
.map-pin-remove:hover { opacity: .75; }

/* Dragging state for plant card */
.plant-card--dragging { opacity: .45; }

.image-upload-bar { display: flex; align-items: center; gap: .75rem; margin-top: .5rem; }
.upload-status    { font-size: .82rem; color: var(--muted); }

/* - Plant list - */
/* - Plant card grid - */
.plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.plant-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

/* - Gallery strip - */
.plant-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: #e8ede2;
  min-height: 80px;
  align-items: flex-start;
  align-content: flex-start;
}

.plant-gallery-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.plant-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-del-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .65rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.plant-gallery-item:hover .gallery-del-btn { display: flex; }

.gallery-add-btn {
  width: 72px;
  height: 72px;
  border: 2px dashed var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  background: none;
  transition: border-color .15s, color .15s;
}
.gallery-add-btn:hover { border-color: var(--accent); color: var(--accent); }

.plant-gallery-empty {
  font-size: .72rem;
  color: var(--muted);
  padding: .4rem .2rem;
  align-self: center;
}

.plant-card-body {
  padding: .5rem .6rem .35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.plant-card-name  { font-size: .82rem; line-height: 1.3; }
.plant-card-notes { font-size: .72rem; color: var(--muted); }

.plant-card-actions {
  display: flex;
  gap: .3rem;
  padding: .35rem .6rem .5rem;
  border-top: 1px solid var(--border);
}

/* - Add plant modal photo preview - */
.plant-img-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: .4rem;
}
.plant-img-preview-list img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* - Plant card body as link - */
.plant-card-num {
  padding: .35rem .6rem 0;
}

a.plant-card-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .35rem .6rem .35rem;
  flex: 1;
  color: inherit;
  text-decoration: none;
}
a.plant-card-body:hover .plant-card-name { color: var(--accent); text-decoration: underline; }

/* - Placement list (plant detail page) - */
.placement-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.placement-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
}
.placement-badge {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  font-size: .78rem;
}
.placement-zone-link {
  flex: 1;
  font-size: .9rem;
}
.placement-del { margin-left: auto; }

/* - Plant detail page - */
.plant-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: .9rem;
  font-weight: 700;
  margin-right: .35rem;
  vertical-align: middle;
}

.plant-detail-sci,
.plant-detail-family {
  color: var(--muted);
  font-size: .92rem;
  margin-top: .15rem;
}

.plant-detail-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.plant-care-notes { white-space: pre-wrap; }
.plant-care-summary { display: grid; gap: .5rem; }
.plant-care-summary > div { display: grid; grid-template-columns: minmax(7rem, 10rem) 1fr; gap: .5rem; }
.plant-care-summary dt { font-weight: 600; }
.plant-care-summary dd { margin: 0; }
.plant-detail-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.care-guide-section {
  margin-bottom: 1.25rem;
}
.plant-perenual-editor {
  border-top: 1px solid var(--border);
  padding-top: .75rem;
}
.plant-perenual-editor h3 {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}
.plant-perenual-editor p {
  margin: .5rem 0;
  color: var(--muted);
  font-size: .8rem;
}
.plant-perenual-editor textarea {
  width: 100%;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .8rem;
}
.care-guide-type {
  font-size: .9rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--accent);
  margin-bottom: .3rem;
}

/* - Task list - */
.inline-form {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.inline-form input {
  flex: 1;
  min-width: 0;
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
}
.hidden { display: none !important; }

.task-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }

.task-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: opacity .2s, background .15s;
}
.task-item--done { opacity: .55; }
.task-item--done .task-title { text-decoration: line-through; }

.admin-user-item { align-items: flex-start; }
.admin-user-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
  margin-left: auto;
}
.site-main form.admin-lock-form { display: block; }
.admin-password-reset summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
.site-main form.admin-password-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: .5rem;
  width: min(700px, 75vw);
  margin-top: .5rem;
}
.site-main form.admin-password-form label { min-width: 0; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
  padding: 0 2px;
}
.drag-handle:active { cursor: grabbing; }

.task-dragging {
  opacity: .4;
  background: var(--bg);
  border-style: dashed;
}
.task-drag-over {
  background: #e8f0e4;
  border-color: var(--accent);
}
.todo-drag-handle {
  cursor: grab;
}
.todo-drag-handle:active { cursor: grabbing; }

.task-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  font-size: .85rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color .15s, background .15s;
}
.task-check:hover    { border-color: var(--accent); }
.task-check--readonly { cursor: default; }

.task-body  { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.task-title { font-size: .9rem; }
.task-meta  { font-size: .75rem; color: var(--muted); }
.task-del   { opacity: 0; transition: opacity .15s; }
.task-item:hover .task-del { opacity: 1; }

.shopping-form-heading,
.shopping-list-heading {
  margin-bottom: .85rem;
  font-size: 1.05rem;
}
.shopping-add-form {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: .75rem;
}
.shopping-add-form label {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: .2rem;
  color: var(--muted);
  font-size: .82rem;
}
.shopping-add-form input,
.shopping-add-form select {
  min-height: 2.3rem;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.shopping-add-form label input,
.shopping-add-form label select {
  flex: 0 0 auto;
  width: 100%;
}
.shopping-item--purchased { opacity: .55; }
.shopping-item--purchased .task-title { text-decoration: line-through; }
.shopping-item-delete { opacity: 0; }
.shopping-item:hover .shopping-item-delete { opacity: 1; }

.plant-todo-form {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.plant-todo-form label {
  display: flex;
  flex: 1 1 10rem;
  flex-direction: column;
  gap: .2rem;
  font-size: .82rem;
  color: var(--muted);
  min-width: 0;
}
.plant-todo-form input,
.modal-form textarea {
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  color: var(--text);
}
.plant-todo-form input[type="text"] { min-width: min(240px, 70vw); }
.plant-todo-form input[type="date"] { min-height: 2.25rem; }
.plant-todo-item .task-del { opacity: 1; }
.plant-todo--overdue {
  background: #fde8e6;
  border-color: #f0aaa2;
}
.plant-todo--upcoming {
  background: #fff6dc;
  border-color: #e8cf82;
}
.todo-due-label {
  margin-left: .35rem;
  color: var(--danger);
}
.plant-todo--upcoming .todo-due-label { color: #795b00; }
.todo-type-badge {
  display: inline-block;
  padding: .08rem .45rem;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 700;
  vertical-align: .05rem;
}
.todo-type-badge--landscaping {
  background: #e5e0f2;
  color: #51416f;
}
.zone-shopping-list { margin-top: 1rem; }
.zone-shopping-list .task-del { opacity: 1; }

/* - Rich-text editor - */
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .4rem .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.rte-btn {
  padding: .25rem .55rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  font-size: .82rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1.4;
}
.rte-btn:hover       { background: var(--bg); border-color: var(--border); }
.rte-btn--active     { background: var(--accent); color: #fff; border-color: var(--accent); }

.rte-sep {
  width: 1px;
  background: var(--border);
  margin: .15rem .1rem;
  align-self: stretch;
}

.rte-editor {
  min-height: 160px;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg);
  font-size: .9rem;
  line-height: 1.7;
  outline: none;
}
.rte-editor:focus { border-color: var(--accent); }

.rte-editor h2 { font-size: 1.1rem; margin: .6rem 0 .2rem; }
.rte-editor h3 { font-size: .95rem; margin: .5rem 0 .15rem; }
.rte-editor p  { margin: .25rem 0; }
.rte-editor ul,
.rte-editor ol { padding-left: 1.5rem; margin: .25rem 0; }

.rte-view {
  font-size: .9rem;
  line-height: 1.7;
  color: var(--text);
}
.rte-view h2 { font-size: 1.1rem; margin: .6rem 0 .2rem; }
.rte-view h3 { font-size: .95rem; margin: .5rem 0 .15rem; }
.rte-view p  { margin: .25rem 0; }
.rte-view ul,
.rte-view ol { padding-left: 1.5rem; margin: .25rem 0; }

.rte-save-status { font-size: .78rem; color: var(--muted); }

/* - Auth card - */
.auth-card {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .9rem;
}
.auth-card input {
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  width: 100%;
}
.auth-card .btn { width: 100%; justify-content: center; margin-top: .5rem; }
.auth-footer { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 1rem; }

/* - Modal (dialog) - */
dialog.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  padding: 0;
  width: min(440px, 95vw);
}
dialog.modal::backdrop { background: rgba(0,0,0,.4); }

.modal-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.modal-form h2 { font-size: 1.1rem; }
.modal-form label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .875rem;
  font-weight: 500;
}
.modal-form input,
.modal-form textarea {
  padding: .4rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
  width: 100%;
}
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .25rem; }

/* - Empty states - */
.empty-state {
  color: var(--muted);
  font-size: .875rem;
  padding: .75rem 0;
}

/* - Identify plant screen - */
.identify-section { margin-bottom: 1.5rem; }

.identify-step-label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.identify-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* photo area */
.identify-form { display: flex; flex-direction: column; gap: 1.1rem; }

.identify-photo-area {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.identify-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: #e8ede2;
  color: var(--muted);
  font-size: .85rem;
}

.identify-photo-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: contain;
  display: block;
}

.identify-photo-btns { display: flex; gap: .5rem; flex-wrap: wrap; }

/* search row */
.identify-search-label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .875rem;
  font-weight: 500;
}
.identify-search-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.identify-search-row input {
  flex: 1;
  min-width: 0;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
}
.identify-search-row input:focus { outline: none; border-color: var(--accent); }
.identify-search-hint { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* recap row (step 1 summary when showing results) */
.identify-recap {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.identify-recap-photo {
  width: 120px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.identify-recap-text { font-size: .875rem; line-height: 1.7; }

/* candidates grid */
.identify-results-hint { font-size: .82rem; color: var(--muted); margin-bottom: .9rem; }

.identify-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
  margin-bottom: 1.1rem;
}

.identify-candidate-card {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  padding: 0;
  color: var(--text);
  font: inherit;
}
.identify-candidate-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.identify-candidate-card--selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,124,63,.25);
}

.identify-candidate-img {
  height: 130px;
  overflow: hidden;
  background: #e8ede2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.identify-candidate-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.identify-candidate-noimg { font-size: 2.5rem; }

.identify-candidate-body {
  padding: .55rem .65rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  flex: 1;
}
.identify-candidate-body strong { font-size: .85rem; line-height: 1.3; }
.identify-candidate-body em     { font-size: .72rem; color: var(--muted); font-style: italic; }
.identify-candidate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .6rem;
  margin-top: .3rem;
}
.identify-candidate-meta span { font-size: .7rem; color: var(--muted); }

/* submit row */
.identify-submit-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

/* confidence score badge */
.identify-score-badge {
  position: absolute;
  top: .4rem;
  left: .4rem;
  padding: .15rem .45rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.4;
  pointer-events: none;
}
.identify-score-badge--high { background: #d4edda; color: #276036; }
.identify-score-badge--mid  { background: #fff3cd; color: #7a5c00; }
.identify-score-badge--low  { background: #f8d7da; color: #842029; }

.identify-candidate-family {
  font-size: .7rem;
  color: var(--muted);
  margin-top: .1rem;
}

.identify-candidate-check {
  position: absolute;
  top: .4rem;
  right: .4rem;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.identify-candidate-card--selected .identify-candidate-check { opacity: 1; }

/* confirm panel */
.identify-confirm-form { margin-top: .5rem; }

.identify-confirm-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.identify-confirm-left { font-size: .9rem; }
.identify-confirm-label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .875rem;
  font-weight: 500;
}
.identify-confirm-label input {
  padding: .4rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
}
.identify-confirm-label input:focus { outline: none; border-color: var(--accent); }

/* - Shared form controls - */
.site-main input:not([type="hidden"]),
.site-main select,
.site-main textarea {
  min-height: 2.4rem;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

.site-main input:not([type="hidden"]):focus,
.site-main select:focus,
.site-main textarea:focus {
  outline: 2px solid rgba(74, 124, 63, .25);
  outline-offset: 1px;
  border-color: var(--accent);
}

.site-main textarea {
  min-height: 6rem;
  resize: vertical;
}

.site-main input[type="file"] {
  min-height: auto;
  padding: .35rem;
}

.site-main input[type="checkbox"],
.site-main input[type="radio"] {
  accent-color: var(--accent);
}

.site-main form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .65rem;
}

.site-main form.identify-form,
.site-main form.identify-confirm-form {
  align-items: stretch;
  flex-direction: column;
}

.site-main form label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  color: var(--muted);
  font-size: .85rem;
}

.site-main form > input:not([type="hidden"]),
.site-main form:not(.plant-sort-form) > select {
  flex: 1 1 10rem;
  min-width: 0;
}

.site-main form label input:not([type="hidden"]),
.site-main form label select {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}

.site-main form textarea {
  flex: 0 0 auto;
  width: 100%;
}

.site-main button:not(.btn):not(.task-check):not(.identify-candidate-card) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: .35rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.site-main button:not(.btn):not(.task-check):not(.identify-candidate-card):hover {
  border-color: var(--accent);
  background: #eef3e9;
}

.site-main form input[type="hidden"] {
  display: none;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .1rem;
}

.auth-card input:not([type="hidden"]) {
  width: 100%;
}

.zone-section > form + .task-list,
.zone-section > form + p,
.zone-section > form + div {
  margin-top: .85rem;
}

@media (max-width: 600px) {
  .site-main form {
    align-items: stretch;
  }

  .admin-user-item { flex-direction: column; }
  .admin-user-controls { align-items: stretch; width: 100%; margin-left: 0; }
  .site-main form.admin-password-form {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .site-main form > input:not([type="hidden"]),
  .site-main form:not(.plant-sort-form) > select,
  .site-main form > button {
    flex: 1 1 100%;
    width: 100%;
  }

  .site-main form.shopping-add-form label,
  .site-main form.plant-todo-form label {
    flex: 1 1 100%;
    width: 100%;
  }
}
.identify-confirm-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }

.site-main form.shopping-add-form label > input,
.site-main form.shopping-add-form label > select {
  flex: 0 0 auto;
  width: 100%;
}
