:root {
  --bg: #1c1a17;
  --surface: #242019;
  --surface-2: #2c2721;
  --ink: #ede8de;
  --ink-muted: #95897a;
  --sage: #7c9473;
  --sage-dim: #4a5a44;
  --sage-glow: #9fb596;
  --sand: #c9a66b;
  --brick: #c1694f;
  --hairline: #3a342b;
  --rust: #8b3e2c;
  --learning: #8c8579;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: #0f0e0c;
  color: var(--ink);
  font-family: "Inter", sans-serif;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 12px;
}

.frame {
  width: 100%;
  max-width: 404px;
  background: var(--bg);
  border-radius: 36px;
  border: 1px solid #35302a;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: min(820px, 100dvh);
  height: min(820px, 100dvh);
  position: relative;
}

header {
  padding: 26px 22px 18px;
  border-bottom: 1px solid var(--hairline);
}

.eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

h1 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-style: italic;
  font-size: 30px;
  margin: 2px 0 0;
  letter-spacing: -0.01em;
}

.header-title {
  margin: 2px 0 0;
  line-height: 0;
}

.header-wordmark {
  display: block;
  height: 30px;
  width: auto;
  max-width: 100%;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 22px 4px;
  min-width: 0;
}

.tabs-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  container-type: inline-size;
  container-name: tabs-main;
}

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

.view-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.view-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

.view-btn.active {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--surface-2);
}

.tab {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--hairline);
  cursor: pointer;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
}

.tab-name,
.tab-count {
  display: inline;
}

.tab-count::before {
  content: " ";
}

@container tabs-main (max-width: 16rem) {
  .tab {
    white-space: normal;
    padding: 5px 8px;
  }

  .tab-name,
  .tab-count {
    display: block;
  }

  .tab-count::before {
    content: none;
  }

  .tab-count {
    font-size: 10.5px;
    font-weight: 600;
    margin-top: 1px;
  }
}

.tab.active {
  background: var(--sage-dim);
  color: var(--ink);
  border-color: var(--sage-dim);
}

.sort-select-wrap {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}

.sort-dir-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.sort-dir-btn[aria-pressed="true"] {
  border-color: rgba(201, 166, 107, 0.55);
  color: var(--ink);
}

.sort-dir-btn:focus {
  outline: none;
  border-color: rgba(201, 166, 107, 0.55);
}

.sort-select {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: var(--ink-muted);
  background-color: transparent;
  border: 0;
  border-radius: 0;
  padding: 6px 24px 6px 10px;
  max-width: 7.5rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% + 1px),
    calc(100% - 9px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.sort-select:focus {
  outline: none;
}

.sort-select-wrap:focus-within {
  border-color: rgba(201, 166, 107, 0.55);
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 100px;
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.gallery.active {
  display: grid;
}

.list.hidden {
  display: none;
}

.gallery-tile {
  position: relative;
  width: 100%;
  min-width: 0;
  padding-top: 100%;
  height: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--surface-2);
}

.gallery-tile.is-tilted {
  transform: rotate(var(--gallery-tilt, 0deg));
  z-index: 3;
}

.gallery-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #1a1714;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.gallery-tile.no-photo .gallery-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
}

.gallery-tile.no-photo {
  border: 1.5px dashed var(--hairline);
}

.gallery-tile.no-photo svg {
  width: 26px;
  height: 26px;
  opacity: 0.5;
}

.gallery-tile .label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 14px 6px 5px;
  background: linear-gradient(to top, rgba(10, 9, 7, 0.88) 55%, transparent);
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-tile .status-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(10, 9, 7, 0.6);
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--status-color, var(--hairline));
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}

.thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background-size: cover;
  background-position: center;
}

.thumb.has-photo.is-tilted {
  transform: rotate(var(--thumb-tilt, 0deg));
}

.card-care-corner-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  font-size: 8.5px;
  font-weight: 600;
  padding: 2px 6px;
  line-height: 1.2;
  border-radius: 6px;
  transform: translate(-1px, -1px);
  letter-spacing: 0.03em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  box-shadow:
    0 0 0 1px rgba(10, 9, 7, 0.9),
    0 2px 6px rgba(0, 0, 0, 0.5);
}

.card-care-corner-badge.maintenance {
  background: #2a2318;
  color: #e8c88a;
  border: 1px solid rgba(201, 166, 107, 0.65);
}

.card-care-corner-badge.growth {
  background: #1e2a1c;
  color: #b8d4ae;
  border: 1px solid rgba(124, 148, 115, 0.65);
}

.card > .thumb {
  margin-top: 6px;
}

.thumb.no-photo {
  border: 1.5px dashed var(--hairline);
}

.thumb.no-photo svg {
  width: 22px;
  height: 22px;
  opacity: 0.6;
}

.info {
  flex: 1;
  min-width: 0;
}

.info-top {
  min-width: 0;
}

.name {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 17px;
}

.species {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 1px;
}

.fit-text {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill.ok {
  background: rgba(124, 148, 115, 0.18);
  color: var(--sage-glow);
}

.pill.soon {
  background: rgba(201, 166, 107, 0.18);
  color: var(--sand);
}

.pill.due {
  background: rgba(193, 105, 79, 0.2);
  color: var(--brick);
}

.pill.learning {
  background: rgba(140, 133, 121, 0.2);
  color: var(--learning);
}

.pill.prediction {
  background: rgba(140, 133, 121, 0.12);
  color: var(--ink-muted);
  font-size: 10px;
  padding: 2px 7px;
}

.meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--ink-muted);
}

.meta-weight {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta .pill {
  flex-shrink: 0;
}

.meta-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-care-badge {
  font-size: 9.5px;
  padding: 2px 7px;
}

.card-care-badge.maintenance {
  color: var(--sand);
  background: rgba(201, 166, 107, 0.12);
}

button.attr-filter-badge {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  line-height: inherit;
  cursor: pointer;
}

button.attr-filter-badge.attr-filter-active {
  box-shadow: 0 0 0 1px var(--sand);
}

button.care-badge.attr-filter-badge {
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--hairline);
  border-radius: 999px;
}

button.pill.attr-filter-badge {
  border: 1px solid transparent;
}

.meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta b {
  color: var(--ink);
  font-weight: 500;
}

.spark {
  display: block;
  width: 72px;
  height: 22px;
  margin-top: 8px;
}

.fab {
  position: absolute;
  right: 20px;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sage);
  color: #161410;
  border: none;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px -8px rgba(124, 148, 115, 0.55);
  cursor: pointer;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 7, 0.55);
  display: none;
  align-items: flex-end;
  z-index: 10;
}

.sheet-backdrop.open {
  display: flex;
  z-index: 30;
}

.sheet {
  width: 100%;
  max-height: min(92dvh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--hairline);
  padding: 12px 22px 0;
}

.sheet-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.sheet-footer {
  flex-shrink: 0;
  padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hairline);
  background: var(--surface);
}

.sheet-footer .save-btn {
  margin-top: 0;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(36, 32, 25, 0.94);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

.toast.hidden {
  display: none;
}

.sheet-handle {
  display: block;
  width: 36px;
  height: 4px;
  background: var(--hairline);
  border-radius: 99px;
  margin: 0 auto 12px;
  padding: 0;
  border: none;
  cursor: pointer;
}

.sheet-handle::before {
  content: "";
  display: block;
  width: 36px;
  height: 24px;
  margin: -10px auto 0;
}

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

.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.sheet h2 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0;
  flex: 1;
  min-width: 0;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.label-required {
  color: var(--sand);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.field input.field-invalid,
.field select.field-invalid {
  border-color: rgba(193, 105, 79, 0.75);
  box-shadow: 0 0 0 2px rgba(193, 105, 79, 0.15);
}

.field input,
.field select,
.photo-drop,
.note-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-size: 14px;
}

.photo-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
}

.photo-drop.drag-over {
  border-color: var(--sage-glow);
  background: rgba(124, 148, 115, 0.08);
}

.photo-drop .box {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px dashed var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.photo-adjust-btn {
  display: block;
  margin-top: 8px;
  padding: 0;
  border: none;
  background: none;
  color: var(--sage-glow);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.photo-adjust-btn.hidden {
  display: none;
}

.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 9, 7, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-modal.hidden {
  display: none;
}

.photo-modal-card {
  width: min(100%, 360px);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 16px;
}

.photo-modal-card h3 {
  margin: 0 0 6px;
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 600;
}

.photo-modal-viewport {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background-color: var(--surface-2);
  background-repeat: no-repeat;
  cursor: grab;
  touch-action: none;
  margin-top: 10px;
}

.photo-modal-viewport.is-dragging {
  cursor: grabbing;
}

.photo-zoom-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.photo-zoom-label {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1;
}

.photo-zoom-row input[type="range"] {
  width: 100%;
  accent-color: var(--sage);
}

.photo-zoom-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-muted);
  min-width: 40px;
  text-align: right;
}

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

.photo-modal-cancel,
.photo-modal-done {
  flex: 1;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14px;
  cursor: pointer;
}

.photo-modal-cancel {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
}

.photo-modal-done {
  background: var(--sage-dim);
  border: 1px solid var(--sage-dim);
  color: var(--ink);
  font-weight: 500;
}

.delete-plant-btn {
  width: 100%;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(139, 62, 44, 0.45);
  background: transparent;
  color: var(--rust);
  font-size: 14px;
  cursor: pointer;
}

.delete-plant-btn.hidden {
  display: none;
}

.care-toggle {
  display: flex;
  gap: 8px;
}

.care-option {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-muted);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.care-option.active {
  border-color: var(--sage-dim);
  background: rgba(124, 148, 115, 0.15);
  color: var(--ink);
}

.save-btn {
  width: 100%;
  margin-top: 6px;
  background: var(--sage);
  color: #161410;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
}

.detail-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 20;
  display: none;
  flex-direction: column;
}

.detail-overlay.open {
  display: flex;
}

.detail-header {
  padding: calc(22px + env(safe-area-inset-top, 0px)) 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--hairline);
}

.detail-back,
.detail-edit {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.detail-titles {
  flex: 1;
  min-width: 0;
}

.detail-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 19px;
}

.detail-sub {
  font-family: "Inter", sans-serif;
  font-size: 12px;
  color: var(--ink-muted);
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.detail-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background-repeat: no-repeat;
}

.detail-photo.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--hairline);
  background: var(--surface-2);
}

.detail-photo.no-photo svg {
  width: 34px;
  height: 34px;
  opacity: 0.5;
}

.detail-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-chip {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 12px;
}

.stat-chip .label {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-chip .value {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  margin-top: 3px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.section-card h4 {
  font-family: "Inter", sans-serif;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin: 0 0 10px;
  font-weight: 500;
}

.chart-range-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-bottom: 10px;
}

.chart-range-tab {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

.chart-range-tab.active {
  background: var(--sage-dim);
  border-color: var(--sage-dim);
  color: var(--ink);
}

.detail-chart {
  display: block;
  height: 196px;
  margin-top: 2px;
}

.log-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
}

.log-delete-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.log-delete-btn:hover {
  color: var(--rust);
  border-color: rgba(139, 62, 44, 0.45);
}

.log-delete-confirm-btn {
  background: rgba(139, 62, 44, 0.85);
}

.log-delete-confirm-btn:hover {
  background: rgba(139, 62, 44, 1);
}

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

.log-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-watered {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(159, 181, 150, 0.2);
  color: var(--sage-glow);
  font-family: "Inter", sans-serif;
}

.add-log-btn,
.water-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px dashed var(--hairline);
  color: var(--ink-muted);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 8px;
}

.water-btn {
  border-style: solid;
}

.note-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

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

.note-when {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-bottom: 3px;
}

.note-body {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.note-input {
  resize: none;
  margin-bottom: 8px;
}

.note-save-btn {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--ink-muted);
  border-radius: 10px;
  padding: 9px;
  font-family: "Inter", sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  color: var(--ink-muted);
  font-size: 14px;
  padding: 40px 20px;
}

.hidden,
.field.hidden {
  display: none !important;
}

.hidden-input {
  display: none;
}

.field-hint {
  margin: 6px 0 0;
  font-family: "Inter", sans-serif;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-logo {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  display: block;
}

.manage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 16px;
  cursor: pointer;
  margin-top: 8px;
}

.detail-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.care-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--sand);
  background: rgba(201, 166, 107, 0.12);
  white-space: nowrap;
}

.care-badge.growth {
  color: var(--sage-glow);
  background: rgba(127, 148, 115, 0.15);
}

.attr-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.attr-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: start;
}

.attr-row dt {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.attr-row dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field select,
.field input[type="number"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
}

.shelf-view {
  padding: 8px 16px 24px;
  min-height: 0;
  overflow-y: auto;
  flex: 1;
}

.shelf-view.hidden {
  display: none;
}

.shelf-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.shelf-toolbar select {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  padding: 9px 10px;
  font-size: 13px;
}

.shelf-mode-btn {
  flex-shrink: 0;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink-muted);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}

.shelf-mode-btn.active {
  color: var(--sand);
  border-color: rgba(201, 166, 107, 0.45);
  background: rgba(201, 166, 107, 0.12);
}

.shelf-rack {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.03), transparent 55%),
    #0b0a09;
  border: 1px solid #2f2a24;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

.shelf-rack-editing {
  box-shadow:
    inset 0 0 0 1px rgba(201, 166, 107, 0.18),
    0 0 0 1px rgba(201, 166, 107, 0.22),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

.shelf-post {
  background: linear-gradient(
    90deg,
    #151310 0%,
    #4a443c 18%,
    #2a2620 50%,
    #4a443c 82%,
    #151310 100%
  );
  box-shadow:
    inset 0 0 8px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.shelf-rack-body {
  padding: 10px 6px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 12%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 18px
    ),
    #12100e;
}

.shelf-tier {
  position: relative;
  margin-bottom: 18px;
}

.shelf-tier:last-child {
  margin-bottom: 0;
}

.shelf-tier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  padding: 0 2px;
}

.shelf-tier-index {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #b8aa98;
}

.shelf-tier-config {
  color: var(--ink-muted);
  font-size: 10px;
  text-align: right;
  line-height: 1.35;
}

.shelf-deck {
  position: relative;
  min-height: 74px;
  padding: 6px 2px 10px;
}

.shelf-board {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  border-radius: 1px;
  background: linear-gradient(
    180deg,
    #7a7268 0%,
    #4a4338 28%,
    #2f2a24 72%,
    #1a1714 100%
  );
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.shelf-row-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 64px;
}

.shelf-row {
  flex: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-items: flex-end;
  min-height: 58px;
  gap: 8px;
  padding-bottom: 2px;
}

.shelf-add-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin-bottom: 2px;
  border-radius: 6px;
  border: 1px dashed #6a6258;
  background: rgba(18, 16, 14, 0.72);
  color: var(--sand);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.shelf-add-btn:hover {
  border-color: var(--sand);
  background: rgba(201, 166, 107, 0.1);
}

.shelf-bay {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}

.shelf-stack {
  position: absolute;
  inset: 0 0 4px;
}

.shelf-stack-item {
  position: absolute;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  border-radius: 5px 5px 3px 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  box-shadow:
    0 5px 10px rgba(0, 0, 0, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.06);
}

.shelf-stack-item:nth-child(1) {
  top: 0;
  left: 0;
  z-index: 3;
}

.shelf-stack-item:nth-child(2) {
  top: 4px;
  left: 5px;
  z-index: 2;
  opacity: 0.92;
}

.shelf-stack-item:nth-child(3) {
  top: 8px;
  left: 10px;
  z-index: 1;
  opacity: 0.84;
}

.shelf-stack-item.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2c2721 0%, #1f1b17 100%);
}

.shelf-stack-item.no-photo svg {
  width: 20px;
  height: 20px;
}

.shelf-bay.drop-target {
  outline: 2px solid var(--sand);
  outline-offset: 2px;
}

.shelf-bay-insert {
  width: 12px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px dashed transparent;
  box-sizing: border-box;
}

.shelf-bay-insert.drop-target {
  border-color: var(--sand);
  background: rgba(201, 166, 107, 0.12);
}

.shelf-bay-empty {
  border: 1px dashed #6a6258;
  border-radius: 6px;
  background: rgba(18, 16, 14, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shelf-bay-empty-label {
  color: var(--sand);
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.9;
  text-align: center;
  padding: 0 4px;
}

.shelf-rack-editing .shelf-stack-item {
  cursor: grab;
  touch-action: none;
}

.shelf-stack-item.shelf-dragging {
  opacity: 0.35;
}

.shelf-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-size: cover;
  background-color: #2c2721;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 100;
}

.shelf-unplaced {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 2px 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(201, 166, 107, 0.08);
  border: 1px dashed rgba(201, 166, 107, 0.28);
}

.shelf-unplaced-label {
  width: 100%;
  font-size: 10px;
  color: var(--ink-muted);
}

.shelf-unplaced-chip {
  width: 36px;
  height: 36px;
  border-radius: 5px;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: grab;
  touch-action: none;
}

.shelf-unplaced-chip.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2c2721 0%, #1f1b17 100%);
}

.shelf-unplaced-chip.no-photo svg {
  width: 16px;
  height: 16px;
}

.shelf-stack-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--ink);
  border-radius: 999px;
  padding: 1px 5px;
}


.manage-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  display: none;
}

.manage-overlay.open {
  display: block;
}

.manage-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.manage-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 18px;
  border-bottom: 1px solid var(--hairline);
}

.manage-header h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 22px;
}

.manage-tabs {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 0;
}

.manage-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  flex: 0 1 auto;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink-muted);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.manage-tab.active {
  color: var(--ink);
  border-color: var(--sand);
  background: rgba(201, 166, 107, 0.1);
}

.manage-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 24px;
}

.manage-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.manage-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.manage-card p {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.45;
}

.manage-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.manage-actions button:last-child {
  grid-column: 1 / -1;
}

.manage-actions button {
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  cursor: pointer;
}

.manage-actions button.danger-btn {
  color: #e8a598;
  border-color: rgba(139, 62, 44, 0.45);
}

.tier-editor,
.light-editor-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.manage-card input[type="text"],
.manage-card input[type="number"],
.manage-card select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
}

.manage-card .field {
  margin-bottom: 10px;
}

.manage-card .field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.manage-card .mix-editor {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.manage-card .mix-editor.hidden {
  display: none;
}

.plant-checklist {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin: 10px 0;
}

.plant-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.tier-editor-head,
.tier-editor-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
  align-items: start;
}

.tier-editor-head {
  font-size: 11px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.tier-editor-row .tier-index {
  padding-top: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}

.tier-editor-row input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
}

.light-editor-card {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.light-editor-card .field {
  margin-bottom: 10px;
}

.light-editor-card .field:last-of-type {
  margin-bottom: 0;
}

.light-editor-card .field label,
.light-add-form .field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--ink-muted);
}

.light-editor-card input,
.light-editor-card select,
.light-add-form input,
.light-add-form select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
}

.light-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.light-row-actions button {
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 13px;
  cursor: pointer;
}

.light-row-actions button.danger-btn {
  color: #e8a598;
  border-color: rgba(139, 62, 44, 0.45);
}

.light-add-form {
  display: grid;
  gap: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

.light-add-form strong {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
}

.light-add-form .field {
  margin-bottom: 10px;
}

.light-add-form .save-btn {
  margin-top: 4px;
}

.picker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 55;
  display: flex;
  align-items: flex-end;
}

.picker-overlay.hidden {
  display: none;
}

.picker-panel {
  width: 100%;
  max-height: 70%;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 16px 18px 20px;
  overflow-y: auto;
}

.picker-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.picker-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}

.picker-item:hover {
  border-color: var(--sand);
}

.picker-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.picker-thumb.no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.picker-thumb.no-photo svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 480px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    height: 100%;
    background: var(--bg);
  }

  body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: manipulation;
    background: var(--bg);
  }

  .frame {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    touch-action: manipulation;
  }

  .sort-select,
  .sort-dir-btn,
  .field input,
  .field select,
  .field textarea,
  .note-input,
  .shelf-toolbar select,
  .manage-card input[type="text"],
  .manage-card input[type="number"],
  .manage-card select,
  .tier-editor-row input,
  .light-editor-card input,
  .light-editor-card select,
  .light-add-form input,
  .light-add-form select {
    font-size: 16px;
  }

  header {
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }

  .list,
  .gallery {
    padding: 14px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .fab {
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: env(safe-area-inset-bottom, 16px);
  }

  .sheet {
    max-height: min(94dvh, 720px);
  }

  .tabs {
    gap: 4px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .tabs-main {
    gap: 4px;
  }

  .view-switch {
    gap: 3px;
  }

  .tab {
    padding: 5px 8px;
  }

  .sort-select {
    max-width: 4.75rem;
    padding: 5px 20px 5px 8px;
    font-size: 11px;
  }

  .sort-dir-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .view-btn {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }
}

