:root {
  --bg: #f6f0e5;
  --surface: #ffffff;
  --ink: #2a241c;
  --muted: #8a7f6e;
  --terracotta: #ad5c37;
  --olive: #6e7a52;
  --warn: #a8452e;
  --cold: #436a80;
  --line: #e6dcc8;
  --tile: #f1e8d9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--terracotta);
  outline-offset: 1px;
}

label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 6px;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  padding-bottom: 90px;
}

.topbar {
  padding: 22px 20px 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  flex: none;
}

.topbar .back-btn svg {
  width: 20px;
  height: 20px;
}

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

.topbar .eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 25px;
  margin: 3px 0 0;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-action {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-action svg {
  width: 17px;
  height: 17px;
}

.section-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 20px;
  margin: 22px 0 10px;
}

/* Jardín grid */
.grid {
  padding: 4px 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: left;
  display: block;
  width: 100%;
}

.gcard .thumb {
  height: 92px;
  border-radius: 11px;
  margin-bottom: 11px;
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gcard .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gcard .thumb svg {
  width: 26px;
  height: 26px;
  color: var(--olive);
}

.gcard .nick {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 13.5px;
}

.gcard .sci {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
}

.moisture {
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin-top: 9px;
  overflow: hidden;
}

.moisture i {
  display: block;
  height: 100%;
  border-radius: 2px;
}

.empty-state {
  margin: 40px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--olive);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 18px;
}

.filters {
  display: flex;
  gap: 8px;
  padding: 0 16px 4px;
  overflow-x: auto;
}

.chip {
  flex: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.chip.active {
  border-color: var(--terracotta);
  color: var(--terracotta);
  background: var(--tile);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.star-picker {
  display: flex;
  gap: 6px;
}

.star-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--line);
}

.star-btn svg {
  width: 18px;
  height: 18px;
}

.star-btn.active {
  color: var(--terracotta);
  border-color: var(--terracotta);
  background: var(--tile);
}

/* Hoy */
.banner {
  margin: 0 20px 8px;
  background: var(--surface);
  border: 1px solid #e9c9b4;
  border-left: 3px solid var(--warn);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.banner.cold {
  border-color: #b8d3de;
  border-left-color: var(--cold);
}

.banner .ic {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--warn);
  margin-top: 1px;
}

.banner.cold .ic {
  color: var(--cold);
}

.banner b {
  font-weight: 600;
}

.plant-card {
  margin: 0 20px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  width: calc(100% - 40px);
  text-align: left;
}

.plant-card.overdue {
  border-color: #dfaf95;
}

.icon-tile {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: none;
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.icon-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.icon-tile svg {
  width: 21px;
  height: 21px;
  color: var(--olive);
}

.plant-card.overdue .icon-tile svg {
  color: var(--warn);
}

.plant-card .meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.plant-card .nick {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
}

.plant-card .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
}

.tap svg {
  width: 16px;
  height: 16px;
}

.forecast {
  display: flex;
  gap: 7px;
  padding: 0 20px;
  overflow-x: auto;
  margin-bottom: 6px;
}

.fday {
  flex: none;
  width: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 0 8px;
  text-align: center;
}

.fday .d {
  font-size: 9.5px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.03em;
}

.fday .t {
  font-size: 12.5px;
  margin-top: 5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fday.due {
  border-color: var(--terracotta);
}

.fday.due .t {
  color: var(--terracotta);
}

/* Planta detail */
.photo-strip {
  display: flex;
  gap: 8px;
  padding: 0 20px 4px;
  overflow-x: auto;
}

.photo-strip .frame {
  flex: none;
  width: 96px;
  height: 96px;
  border-radius: 14px;
  background: var(--tile);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-strip .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-strip .frame.add-frame {
  border: 1.5px dashed var(--line);
  color: var(--muted);
}

.photo-strip .frame svg {
  width: 22px;
  height: 22px;
  color: var(--olive);
}

.card {
  margin: 0 20px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
}

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

.field-grid .fk {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field-grid .fv {
  font-size: 13.5px;
  margin-top: 2px;
}

.actions-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 4px;
  overflow-x: auto;
}

.action-btn {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  color: var(--olive);
}

.action-btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.action-btn.primary svg {
  color: var(--bg);
}

.timeline {
  padding: 0 20px;
}

.tl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.tl-delete {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.tl-delete:hover,
.tl-delete:active {
  color: var(--warn);
  background: var(--tile);
}

.tl-delete svg {
  width: 15px;
  height: 15px;
}

.tl-item:last-child {
  border-bottom: none;
}

.tl-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.tl-icon svg {
  width: 15px;
  height: 15px;
  color: var(--olive);
}

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

.tl-title {
  font-size: 13.5px;
  font-weight: 500;
}

.tl-date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tl-notes {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
}

.icon-sm {
  display: inline-flex;
  vertical-align: -3px;
}

.icon-sm svg {
  width: 14px;
  height: 14px;
}

/* Form (Añadir / edit) — a single vertical rhythm via flex gap. Every
   label+control pair is wrapped in .field so the 6px label-to-control
   spacing stays tight while the 22px gap applies uniformly between
   fields, rows, and section breaks. */
.form {
  padding: 4px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field label {
  margin: 0 0 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 12px;
}

.suggest-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.25);
}

.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font-size: 13.5px;
  font-style: italic;
  border-bottom: 1px solid var(--line);
}

.suggest-item:last-child {
  border-bottom: none;
}

.suggest-item:hover,
.suggest-item:active {
  background: var(--tile);
}

.form .section-label {
  padding: 20px 0 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

.checkbox-row label {
  margin: 0;
  text-transform: none;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: normal;
  color: var(--ink);
}

.submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--terracotta);
  color: #fff6ee;
  font-weight: 600;
  font-size: 14.5px;
  text-align: center;
}

.cover-upload {
  height: 140px;
  border-radius: 14px;
  border: 1.5px dashed var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  position: relative;
}

.cover-upload img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-upload svg {
  width: 24px;
  height: 24px;
  color: var(--olive);
}

/* Bottom nav */
.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  padding: 11px 0 calc(14px + env(safe-area-inset-bottom));
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.navbar .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.navbar .nav-item svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.navbar .nav-item.active {
  color: var(--ink);
}

.navbar .nav-item.active svg {
  color: var(--terracotta);
}

.stub {
  margin: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.stub svg {
  width: 30px;
  height: 30px;
  color: var(--olive);
  margin-bottom: 12px;
}

.stub p {
  font-size: 13.5px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
