:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef3ee;
  --text: #1f2923;
  --muted: #69756f;
  --line: #dce4dd;
  --green: #3f7f5d;
  --green-dark: #285d42;
  --sage: #91a894;
  --amber: #bf8144;
  --red: #b45c59;
  --blue: #577f9b;
  --shadow: 0 18px 45px rgba(42, 64, 50, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(246, 247, 244, 0.96), rgba(238, 243, 238, 0.96)),
    url("/uploads/plant_photos/plant_green_001_20260512.svg");
  background-size: cover;
  background-attachment: fixed;
}

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

button,
input,
textarea {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 6px 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #d9e5dc;
}

.brand-title {
  font-weight: 760;
  line-height: 1.15;
}

.brand-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.nav a {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #3f4c45;
  font-size: 14px;
}

.nav a.active {
  background: var(--green);
  color: white;
  box-shadow: 0 10px 25px rgba(63, 127, 93, 0.22);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-weight: 760;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 4px 0 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.top-note {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e4f0e8;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 20px;
}

.panel-title {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.25;
}

.muted {
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.plant-hero {
  overflow: hidden;
}

.plant-hero img {
  width: 100%;
  height: 320px;
  display: block;
  object-fit: cover;
}

.plant-hero-info {
  padding: 16px;
}

.plant-name {
  font-size: 24px;
  font-weight: 780;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
}

.metric-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.task-list,
.timeline,
.log-list {
  display: grid;
  gap: 10px;
}

.task,
.event,
.log-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.task strong,
.event strong,
.log-item strong {
  display: block;
  margin-bottom: 3px;
}

.task.done {
  background: #edf5ef;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e9efe9;
  color: #355744;
  font-size: 13px;
  font-weight: 650;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  background: var(--green);
  color: white;
  cursor: pointer;
  font-weight: 740;
}

.btn.secondary {
  background: #e8eee9;
  color: #30473a;
}

.btn.warn {
  background: var(--red);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.trend {
  height: 160px;
  display: flex;
  align-items: end;
  gap: 9px;
  padding-top: 18px;
}

.bar {
  flex: 1;
  min-width: 18px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #6fae82, #3f7f5d);
  position: relative;
}

.bar.stress {
  background: linear-gradient(180deg, #d49a5f, #bf8144);
}

.bar span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 120px);
}

.plant-side img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.messages {
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: min(680px, 82%);
  padding: 13px 15px;
  border-radius: 8px;
  line-height: 1.62;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #dfeee5;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--line);
}

.message.blocked {
  border-color: #e2b8b6;
  background: #fff2f1;
}

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

.action-card {
  border: 1px solid #d6e2d8;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f4faf5;
  color: #315a40;
  font-size: 13px;
  font-weight: 680;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.composer textarea {
  min-height: 46px;
  max-height: 130px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.suggestions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: white;
  color: #3e5147;
  cursor: pointer;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.photo-card {
  overflow: hidden;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-card .body {
  padding: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.score-control {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.score-control input {
  width: 100%;
  accent-color: var(--green);
}

.note-box {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main {
    padding: 18px;
  }

  .hero,
  .chat-layout,
  .grid.cols-2,
  .grid.cols-3,
  .metric-row,
  .form-grid,
  .admin-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: block;
  }

  .status-pill {
    margin-top: 12px;
  }
}

@media (max-width: 560px) {
  .nav {
    grid-template-columns: 1fr 1fr;
  }

  h1 {
    font-size: 28px;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 100%;
  }
}
