.trend {
  min-height: 340px;
  overflow: hidden;
}

.line-chart {
  height: 210px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: stretch;
  overflow: hidden;
}

.line-chart.combined {
  height: 285px;
}

.line-chart.dual-axis {
  grid-template-columns: 76px 1fr 42px;
}

.axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.axis.right {
  text-align: left;
}

.axis.target-axis {
  font-size: 11px;
  line-height: 1.2;
}

.axis.target-axis.right {
  color: transparent;
}

.plot {
  position: relative;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 190px;
  overflow: hidden;
  background: #fbfcf8;
}

.combined .plot {
  min-height: 220px;
}

.trend-svg {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.trend-line {
  fill: none;
  stroke-width: 1.9;
  vector-effect: non-scaling-stroke;
  opacity: 0.9;
}

.trend-band {
  opacity: 0.65;
}

.trend-marker {
  cursor: pointer;
}

.trend-marker circle {
  pointer-events: all;
}

.marker-x-line {
  stroke-linecap: round;
  stroke-width: 5px;
  paint-order: stroke;
  vector-effect: non-scaling-stroke;
}

.trend-marker:hover .marker-x-line,
.trend-marker:focus-visible .marker-x-line {
  stroke-width: 7px;
}

.trend-mini-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.trend-mini-row {
  display: grid;
  grid-template-columns: 86px 48px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  min-height: 118px;
}

.mini-metric {
  display: grid;
  align-content: center;
  gap: 3px;
  font-size: 13px;
}

.mini-metric strong {
  font-size: 15px;
}

.mini-metric span {
  color: var(--muted);
}

.mini-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  padding: 2px 0 8px;
}

.mini-plot {
  position: relative;
  min-height: 112px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  background: #fbfcf8;
}

.mini-date-axis {
  position: relative;
  height: 28px;
  margin-left: 144px;
  color: var(--muted);
  font-size: 11px;
}

.mini-date-axis span {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.trend-tooltip {
  position: fixed;
  z-index: 2000;
  box-sizing: border-box;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px 8px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
  transition: opacity 0.08s ease;
  white-space: normal;
  overflow-wrap: anywhere;
}

.point {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-2);
  transform: translate(-50%, 50%);
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.point.abnormal {
  background: var(--danger);
}

.x-point {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: currentColor;
  box-shadow: none;
  font-size: 16px;
  line-height: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.9);
}

.x-point.abnormal {
  background: transparent;
}

.point::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  min-width: 64px;
  max-width: 120px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
  transition: opacity 0.12s ease;
}

.point:hover::after,
.point:focus-visible::after {
  opacity: 1;
}

.target-band {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(21, 128, 61, 0.12);
  border-top: 1px dashed rgba(21, 128, 61, 0.55);
  border-bottom: 1px dashed rgba(21, 128, 61, 0.55);
}

.range-band {
  position: absolute;
  left: 4px;
  right: 4px;
  border-top: 1px dashed currentColor;
  border-bottom: 1px dashed currentColor;
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}

.x-axis {
  position: relative;
  height: 34px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
}

.x-axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
}

.check-chip input {
  width: 16px;
  height: 16px;
}

.check-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: #fffefb;
}

