*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #3a7d44;
  --green-light: #e8f5e9;
  --green-mid: #a8d5b5;
  --bg: #f2f7f2;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #6e6e73;
  --border: #e5e5ea;
  --red: #ff3b30;
  --orange: #ff9500;
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* Layout */
.app-shell {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.header {
  padding: 48px 20px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.header-logo svg {
  flex-shrink: 0;
}

.header-logo-wordmark {
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--green);
  font-family: var(--font);
}

.header p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Nav tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 0 20px 16px;
  background: var(--bg);
}

.tab-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--green);
  color: white;
}

/* Content */
.content {
  flex: 1;
  padding: 0 20px 100px;
  overflow-y: auto;
}

/* Section label */
.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 8px;
}

/* Plant card */
.plant-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.plant-card:active { transform: scale(0.98); }

.plant-emoji {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

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

.plant-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.plant-type {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.water-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 6px;
}

.water-badge.due { background: #fff3e0; color: #e65100; }
.water-badge.today { background: #fce4ec; color: #c62828; }
.water-badge.ok { background: var(--green-light); color: var(--green); }

.chevron {
  color: var(--border);
  font-size: 18px;
  flex-shrink: 0;
}

/* Water button on card */
.water-btn {
  background: var(--green-light);
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.water-btn:active { background: var(--green-mid); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 15px; line-height: 1.5; }

/* FAB */
.fab {
  position: fixed;
  bottom: 32px;
  right: 50%;
  transform: translateX(50%);
  max-width: 390px;
  width: calc(100% - 40px);
  background: var(--green);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(58,125,68,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 20;
}
.fab:active { transform: translateX(50%) scale(0.97); }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-sheet {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Form */
.form-group { margin-bottom: 16px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  display: block;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
}

.form-textarea { resize: none; height: 80px; }

.emoji-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.emoji-option {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: var(--green-light);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.emoji-option.selected { border-color: var(--green); }

/* Buttons */
.btn-row { display: flex; gap: 10px; margin-top: 20px; }

.btn-primary {
  flex: 1;
  background: var(--green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.btn-secondary {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
}

.btn-danger {
  width: 100%;
  background: #fff0f0;
  color: var(--red);
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  margin-top: 10px;
}

/* Detail view */
.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.detail-emoji {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.detail-name { font-size: 24px; font-weight: 700; }
.detail-type { font-size: 15px; color: var(--text-secondary); margin-top: 2px; }

.info-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row-label { font-size: 15px; color: var(--text-secondary); }
.info-row-value { font-size: 15px; font-weight: 500; }

.back-btn {
  background: none;
  border: none;
  color: var(--green);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  font-family: var(--font);
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--green-light); }
.autocomplete-item-emoji { font-size: 20px; }
.autocomplete-item-info { flex: 1; }
.autocomplete-item-name { font-size: 15px; font-weight: 500; }
.autocomplete-item-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.plant-info-banner {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--green);
  line-height: 1.5;
}
.plant-info-banner strong { font-weight: 600; }
.notif-banner {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--green);
  font-weight: 500;
}

/* Today summary card */
.summary-card {
  background: var(--green);
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  margin-bottom: 20px;
}
.summary-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.summary-card p { font-size: 14px; opacity: 0.85; }
.summary-stats { display: flex; gap: 20px; margin-top: 14px; }
.stat { text-align: center; }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; opacity: 0.8; margin-top: 2px; }

/* Photo upload */
.photo-upload {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg);
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s;
}
.photo-upload:hover { border-color: var(--green); }
.photo-upload img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.photo-upload-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.photo-upload-icon { font-size: 28px; }
.photo-upload input { display: none; }

.plant-card-photo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
}

.detail-photo {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

/* Dark mode */
body.dark {
  --green: #5cb270;
  --green-light: #1a3a1f;
  --green-mid: #2d5a35;
  --bg: #1c1c1e;
  --surface: #2c2c2e;
  --text: #f2f2f7;
  --text-secondary: #98989d;
  --border: #3a3a3c;
}

body.dark .header { background: var(--bg); }
body.dark .summary-card { background: var(--green-mid); }
body.dark .plant-info-banner { background: var(--green-light); }
body.dark .photo-upload { border-color: var(--border); background: var(--surface); }
