.tree-health-section {
  overflow: hidden;
  border-color: rgba(166, 205, 130, 0.18);
  background:
    radial-gradient(circle at 100% 0%, rgba(196, 226, 77, 0.08), transparent 38%),
    rgba(255, 255, 255, 0.03);
}

.tree-history-refresh {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(166, 205, 130, 0.2);
  border-radius: 999px;
  background: rgba(166, 205, 130, 0.07);
  color: #c9deb7;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 900;
}

.tree-history-refresh:disabled {
  opacity: 0.5;
}

.tree-health-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.tree-health-score {
  --tree-health-score: 0;
  --tree-health-color: #9eaaa1;
  width: 82px;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--tree-health-color) calc(var(--tree-health-score) * 1%), rgba(220, 232, 217, 0.1) 0);
  box-shadow: inset 0 0 0 1px rgba(226, 235, 218, 0.1), 0 12px 28px rgba(0, 0, 0, 0.16);
}

.tree-health-score::before {
  width: 64px;
  aspect-ratio: 1;
  position: absolute;
  border-radius: 50%;
  background: #15231a;
  box-shadow: inset 0 0 0 1px rgba(226, 235, 218, 0.08);
  content: "";
}

.tree-health-score > span {
  width: 100%;
  z-index: 1;
  display: grid;
  justify-items: center;
  color: #f9f4e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.tree-health-score small {
  max-width: 48px;
  margin-top: 3px;
  color: #8f9b92;
  font-family: inherit;
  font-size: 0.32rem;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-transform: uppercase;
}

.tree-health-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.tree-health-copy-head {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.tree-health-copy strong {
  color: #fff8e9;
  font-size: 1rem;
}

.tree-health-trend {
  padding: 4px 8px;
  border: 1px solid rgba(218, 226, 216, 0.12);
  border-radius: 999px;
  color: #c4cec5;
  font-size: 0.59rem;
  font-weight: 950;
  text-transform: uppercase;
}

.tree-health-trend[data-trend="improving"] {
  border-color: rgba(102, 188, 126, 0.28);
  background: rgba(102, 188, 126, 0.1);
  color: #bce7c5;
}

.tree-health-trend[data-trend="declining"] {
  border-color: rgba(225, 91, 78, 0.32);
  background: rgba(225, 91, 78, 0.1);
  color: #ffc5bd;
}

.tree-health-copy p {
  margin: 0;
  color: #acb8ae;
  font-size: 0.72rem;
  line-height: 1.5;
}

.tree-health-chart {
  min-height: 124px;
  overflow: hidden;
  border: 1px solid rgba(226, 235, 218, 0.08);
  border-radius: 15px;
  background: rgba(4, 10, 7, 0.22);
}

.tree-health-chart svg {
  width: 100%;
  height: 124px;
  display: block;
}

.tree-health-chart-grid {
  stroke: rgba(216, 229, 211, 0.09);
  stroke-width: 1;
}

.tree-health-chart-area {
  fill: url(#tree-health-area-gradient);
}

.tree-health-chart-line {
  fill: none;
  stroke: #a9ce84;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.tree-health-chart-point {
  fill: #c7e24d;
  stroke: #15231a;
  stroke-width: 3;
}

.tree-health-chart-label {
  fill: #8f9b92;
  font: 700 9px ui-sans-serif, sans-serif;
}

.tree-health-chart-empty {
  min-height: 124px;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 20px;
  color: #8f9b92;
  text-align: center;
}

.tree-health-chart-empty strong {
  color: #dce5db;
  font-size: 0.76rem;
}

.tree-health-chart-empty span {
  max-width: 330px;
  font-size: 0.66rem;
  line-height: 1.45;
}

.tree-health-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.tree-health-metrics > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid rgba(226, 235, 218, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.tree-health-metrics span {
  color: #819087;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tree-health-metrics strong {
  overflow: hidden;
  color: #e9efe6;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-health-disclosure {
  margin: 0;
  color: #758279;
  font-size: 0.57rem;
  line-height: 1.45;
}

.tree-history-section {
  min-width: 0;
}

.tree-history-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tree-history-filters::-webkit-scrollbar {
  display: none;
}

.tree-history-filters button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(226, 235, 218, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #8f9b92;
  font: inherit;
  font-size: 0.6rem;
  font-weight: 850;
}

.tree-history-filters button.is-active {
  border-color: rgba(165, 201, 133, 0.36);
  background: rgba(165, 201, 133, 0.12);
  color: #dcebd0;
}

.tree-history-timeline {
  display: grid;
  gap: 0;
}

.tree-history-more {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(165, 201, 133, 0.2);
  border-radius: 12px;
  background: rgba(165, 201, 133, 0.07);
  color: #c8ddb6;
  font: inherit;
  font-size: 0.66rem;
  font-weight: 900;
}

.tree-history-event {
  min-width: 0;
  position: relative;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  column-gap: 10px;
  padding: 8px 0 12px;
}

.tree-history-event.is-route-target {
  border-radius: 14px;
  background: color-mix(in srgb, var(--as-gold-300, #d8b96f) 14%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--as-gold-300, #d8b96f) 54%, transparent);
}

.tree-history-event:not(:last-child)::before {
  width: 1px;
  position: absolute;
  top: 24px;
  bottom: -2px;
  left: 7px;
  background: rgba(211, 224, 207, 0.12);
  content: "";
}

.tree-history-event-dot {
  width: 11px;
  height: 11px;
  z-index: 1;
  margin: 4px 0 0 2px;
  border: 2px solid #17261c;
  border-radius: 50%;
  background: #87948b;
  box-shadow: 0 0 0 2px rgba(135, 148, 139, 0.18);
}

.tree-history-event[data-history-type="inspection"] .tree-history-event-dot {
  background: #a9ce84;
}

.tree-history-event[data-history-type="work"] .tree-history-event-dot {
  background: #62bd7d;
}

.tree-history-event[data-history-type="professional"] .tree-history-event-dot {
  background: #d68b54;
}

.tree-history-event[data-history-type="client"] .tree-history-event-dot {
  background: #ddb347;
}

.tree-history-event[data-history-type="photo"] .tree-history-event-dot {
  background: #78a9ce;
}

.tree-history-event-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.tree-history-event-copy strong {
  color: #edf2e9;
  font-size: 0.74rem;
}

.tree-history-event-copy p {
  margin: 0;
  color: #9ca8a0;
  font-size: 0.66rem;
  line-height: 1.42;
}

.tree-history-event-copy small {
  color: #748178;
  font-size: 0.57rem;
}

.tree-history-event time {
  padding-top: 2px;
  color: #7f8b83;
  font-size: 0.58rem;
  font-weight: 800;
  white-space: nowrap;
}

.action-item-controls {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.action-complete-button {
  border-color: rgba(97, 188, 125, 0.28) !important;
  background: rgba(97, 188, 125, 0.1) !important;
  color: #bce7c5 !important;
}

.tree-review-professional-actions {
  grid-template-columns: repeat(3, minmax(96px, 1fr));
}

body.inventory-light-mode .tree-health-section {
  border-color: rgba(68, 111, 63, 0.17);
  background:
    radial-gradient(circle at 100% 0%, rgba(157, 189, 67, 0.12), transparent 38%),
    rgba(255, 255, 255, 0.56);
}

body.inventory-light-mode .tree-health-score::before {
  background: #f6f2e9;
}

body.inventory-light-mode .tree-health-score > span,
body.inventory-light-mode .tree-health-copy strong,
body.inventory-light-mode .tree-health-metrics strong,
body.inventory-light-mode .tree-history-event-copy strong,
body.inventory-light-mode .tree-health-chart-empty strong {
  color: #17241c;
}

body.inventory-light-mode :where(.tree-health-chart, .tree-health-metrics > div) {
  border-color: rgba(31, 49, 39, 0.1);
  background: rgba(255, 255, 255, 0.58);
}

body.inventory-light-mode :where(.tree-health-copy p, .tree-history-event-copy p) {
  color: #5c6a61;
}

body.inventory-light-mode .tree-history-event-dot {
  border-color: #f6f2e9;
}

body.inventory-light-mode .tree-history-filters button {
  border-color: rgba(31, 49, 39, 0.12);
  background: rgba(255, 255, 255, 0.55);
  color: #657169;
}

body.inventory-light-mode .tree-history-filters button.is-active {
  border-color: rgba(75, 120, 68, 0.34);
  background: rgba(75, 120, 68, 0.1);
  color: #29482f;
}

body.inventory-light-mode .tree-history-more {
  border-color: rgba(75, 120, 68, 0.2);
  background: rgba(75, 120, 68, 0.07);
  color: #2e5033;
}

@media (max-width: 760px) {
  .tree-health-summary {
    gap: 11px;
  }

  .tree-health-score {
    width: 72px;
  }

  .tree-health-score::before {
    width: 56px;
  }

  .tree-health-score > span {
    font-size: 1.28rem;
  }

  .tree-health-chart,
  .tree-health-chart svg,
  .tree-health-chart-empty {
    min-height: 108px;
    height: 108px;
  }

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

  .tree-history-event {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .tree-history-event time {
    grid-column: 2;
    grid-row: 2;
    padding: 2px 0 0;
  }

  .tree-review-professional-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .action-item-card {
    align-items: flex-start;
  }

  .action-item-controls {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tree-health-score,
  .tree-health-chart-line {
    transition: none;
  }
}
