:root {
  --ink: #18362b;
  --muted: #73827b;
  --line: #dfe8e1;
  --leaf: #2f8f63;
  --leaf-dark: #176142;
  --mint: #ecf8ef;
  --sage: #f5f8f2;
  --sun: #f5d06f;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(37, 67, 50, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f8fbf5 0%, #eef7ef 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.76);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 800;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 10px 10px 10px 4px;
  background: radial-gradient(circle at 70% 28%, #9fe3a5 0 24%, transparent 25%), var(--leaf);
  transform: rotate(-10deg);
}

.side-nav {
  display: grid;
  gap: 7px;
}

.nav-item,
.mobile-item,
.ghost,
.text-button {
  border: 0;
  color: var(--muted);
  background: transparent;
}

.nav-item {
  width: 100%;
  padding: 13px 15px;
  border-radius: 8px;
  text-align: left;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item.active {
  color: var(--leaf-dark);
  background: var(--mint);
}

.tab-icon {
  width: 19px;
  height: 19px;
  display: inline-block;
  flex: 0 0 auto;
  color: currentColor;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.icon-today {
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 2h2v3H7V2Zm8 0h2v3h-2V2ZM4 5h16a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Zm0 6v9h16v-9H4Zm3 2h4v4H7v-4Z'/%3E%3C/svg%3E");
}

.icon-plants {
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 22c-1.5-3.8-1.1-7.2 1.1-10.2C10.4 9.8 8 7.8 6 5.7 9.7 4.8 13.5 5.8 16 9c.8-2.7 2.3-4.9 4.6-6.7.7 4.6-.5 8-3.6 10.3 1.4 2.6 1.6 5.7.5 9.4H12Zm-7.8-8.5c3.5-.7 6.1.1 7.8 2.4-3.4 1.2-6.3.4-7.8-2.4Z'/%3E%3C/svg%3E");
}

.icon-journal {
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3h11a3 3 0 0 1 3 3v15H7a3 3 0 0 1-3-3V4a1 1 0 0 1 1-1Zm2 14a1 1 0 0 0 0 2h10V6a1 1 0 0 0-1-1H6v12.2c.3-.1.6-.2 1-.2Zm2-9h6v2H9V8Zm0 4h5v2H9v-2Z'/%3E%3C/svg%3E");
}

.icon-library {
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 4.5A2.5 2.5 0 0 1 6.5 2H20v17H7a2 2 0 1 0 0 4h13v-2H7a1 1 0 0 1 0-2h13V2h-1v15H6.5A2.5 2.5 0 0 1 4 14.5v-10ZM7 6h8v2H7V6Zm0 4h7v2H7v-2Z'/%3E%3C/svg%3E");
}

.icon-social {
  mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3a8 8 0 0 0-6.7 12.4L4 21l5.1-2A8 8 0 1 0 12 3Zm-4 8a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm8 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm-8 5c1-1.5 2.3-2.2 4-2.2s3 .7 4 2.2H8Z'/%3E%3C/svg%3E");
}

.ghost {
  margin-top: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}

.main {
  min-width: 0;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1fr);
  align-items: stretch;
}

.auth-art {
  padding: 18px;
}

.auth-art img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  align-self: center;
  width: min(520px, calc(100% - 40px));
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--leaf-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.96;
  letter-spacing: 0;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.auth-tab {
  border: 0;
  border-radius: 6px;
  padding: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  color: var(--white);
  background: var(--leaf);
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(47, 143, 99, 0.12);
}

.primary {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--white);
  background: var(--leaf);
  font-weight: 800;
}

.primary:hover {
  background: var(--leaf-dark);
}

.primary.compact {
  min-height: 42px;
}

.form-note {
  min-height: 20px;
  color: #b14b36;
  font-size: 13px;
  font-weight: 700;
}

.demo-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.demo-user {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
}

.demo-user span,
.demo-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-user span {
  font-weight: 800;
}

.demo-user small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 30px 30px 90px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.stat-card,
.plant-card,
.task-card,
.library-card,
.feed-card,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(37, 67, 50, 0.08);
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;
  margin-bottom: 4px;
  font-size: 36px;
  font-weight: 800;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

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

.section-head h2 {
  margin: 0;
}

.lower-head {
  margin-top: 28px;
}

.text-button {
  color: var(--leaf-dark);
  font-weight: 800;
}

.task-list,
.insight-list,
.timeline,
.feed-list {
  display: grid;
  gap: 12px;
}

.task-card {
  padding: 14px;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
}

.task-card img,
.plant-card img,
.library-card img {
  width: 100%;
  object-fit: cover;
  background: var(--mint);
}

.task-card img {
  height: 64px;
  border-radius: 8px;
}

.task-card h3,
.plant-card h3,
.library-card h3,
.feed-card h3,
.timeline-card h3,
.insight-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.meta,
.plant-card p,
.library-card p,
.feed-card p,
.timeline-card p,
.insight-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.insight-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(37, 67, 50, 0.08);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.pill {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--leaf-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

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

.plant-card,
.library-card,
.feed-card,
.timeline-card {
  overflow: hidden;
}

.plant-card img,
.library-card img {
  height: 220px;
}

.card-body {
  padding: 16px;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.care-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.care-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--leaf-dark);
  background: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.small-button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--white);
  background: var(--leaf);
  font-weight: 800;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.4fr auto;
  gap: 10px;
  margin-bottom: 18px;
}

.diagnosis-form,
.community-form {
  margin-top: -8px;
}

.timeline-card,
.feed-card {
  padding: 16px;
}

.feed-card {
  background: linear-gradient(135deg, #ffffff 0%, #f5fbf1 100%);
}

.feed-image {
  display: block;
  width: calc(100% + 32px);
  height: clamp(190px, 35vw, 320px);
  margin: -16px -16px 16px;
  object-fit: cover;
  background: var(--mint);
}

dialog {
  width: min(460px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(24, 54, 43, 0.34);
}

.modal {
  padding: 20px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  font-size: 22px;
  line-height: 1;
}

.plant-detail {
  display: grid;
  gap: 14px;
}

.post-modal {
  gap: 13px;
}

.post-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  object-fit: cover;
  background: var(--mint);
}

.detail-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  object-fit: cover;
  background: var(--mint);
}

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

.detail-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--sage);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid strong {
  font-size: 14px;
}

.detail-actions {
  margin-top: 0;
}

.detail-note,
.library-tip {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.library-tip {
  margin-top: 14px;
}

.mobile-nav {
  display: none;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    display: none;
  }

  .auth-view {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .auth-art {
    height: 210px;
    padding: 0;
  }

  .auth-art img {
    min-height: 0;
    height: 210px;
  }

  .auth-card {
    width: 100%;
    padding: 24px 4px 80px;
  }

  .workspace {
    padding: 22px 14px 92px;
  }

  .topbar {
    align-items: flex-start;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 14px 10px;
  }

  .stat-card span {
    font-size: 27px;
  }

  .plant-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .task-card {
    grid-template-columns: 58px 1fr;
  }

  .task-card .small-button {
    grid-column: 1 / -1;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    position: fixed;
    z-index: 5;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
  }

  .mobile-item {
    min-height: 44px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 5px 2px;
  }

  .mobile-item .tab-icon {
    width: 17px;
    height: 17px;
  }

  .mobile-item.active {
    color: var(--white);
    background: var(--leaf);
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 39px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar .primary {
    width: 100%;
  }

  .demo-list,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

  .card-actions,
  .insight-card {
    align-items: stretch;
    flex-direction: column;
  }
}
