.psi-chart {
  --psi-chart-surface: #fffdf8;
  --psi-chart-ink: #233a2e;
  --psi-chart-muted: #536354;
  --psi-chart-border: #e1e5d9;
  --psi-chart-grid: #e8ebe3;
  --psi-chart-completed: #47674b;
  --psi-chart-missed: #c5795f;
  --psi-chart-trend: #4e7246;
  --psi-chart-soft: #e9efdd;
  container: psi-chart / inline-size;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  padding: 21px 23px 15px;
  border: 1px solid var(--psi-chart-border);
  border-radius: 18px;
  background: var(--psi-chart-surface);
  color: var(--psi-chart-ink);
  box-shadow: 0 8px 20px rgb(35 58 46 / 3%);
}

.psi-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-height: 53px;
}

.psi-chart-head h2 {
  margin: 0;
  color: inherit;
  font-family: Inter, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 690;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.psi-chart-head p {
  margin: 5px 0 0;
  color: var(--psi-chart-muted);
  font-size: 12px;
  line-height: 1.4;
}

.psi-chart-value {
  display: grid;
  justify-items: end;
  gap: 1px;
  flex: 0 0 auto;
  text-align: right;
}

.psi-chart-value strong {
  color: var(--psi-chart-ink);
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 33px;
  line-height: 0.94;
  white-space: nowrap;
}

.psi-chart-value span {
  color: var(--psi-chart-muted);
  font-size: 11px;
  line-height: 1.35;
}

.psi-chart-body {
  margin: 4px 0 0;
  min-width: 0;
}

.psi-chart-svg {
  display: block;
  width: 100%;
  max-height: 260px;
  overflow: visible;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}

.psi-chart-axes {
  fill: var(--psi-chart-muted);
}

.psi-chart-gridline {
  stroke: var(--psi-chart-grid);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

.psi-chart-bar--completed {
  fill: var(--psi-chart-completed);
}

.psi-chart-bar--missed {
  fill: var(--psi-chart-missed);
}

.psi-chart-line {
  fill: none;
  stroke: var(--psi-chart-trend);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.psi-chart-marker {
  stroke: var(--psi-chart-trend);
  stroke-width: 2px;
  fill: var(--psi-chart-surface);
  vector-effect: non-scaling-stroke;
}

.psi-chart-gradient-start {
  stop-color: #adbf95;
  stop-opacity: 0.42;
}

.psi-chart-gradient-end {
  stop-color: #adbf95;
  stop-opacity: 0.05;
}

.psi-chart-point {
  outline: none;
}

.psi-chart-hit {
  fill: transparent;
}

.psi-chart-point:focus-visible .psi-chart-hit {
  stroke: var(--psi-chart-trend);
  stroke-width: 1.6px;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

.psi-chart-tooltip {
  display: none;
  pointer-events: none;
}

.psi-chart-point:hover .psi-chart-tooltip,
.psi-chart-point:focus-visible .psi-chart-tooltip {
  display: initial;
}

.psi-chart-tooltip rect {
  fill: #263b2f;
}

.psi-chart-tooltip text {
  fill: #fffdf8;
  font-size: 13px;
  font-weight: 600;
}

.psi-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 15px;
  min-height: 23px;
  margin: 3px 0 0;
  color: var(--psi-chart-muted);
  font-size: 11px;
}

.psi-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.psi-chart-key {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.psi-chart-key--completed { background: var(--psi-chart-completed); }
.psi-chart-key--missed { background: var(--psi-chart-missed); }
.psi-chart-key--trend {
  width: 13px;
  height: 3px;
  background: var(--psi-chart-trend);
}

.psi-chart-note {
  margin: 5px 0 9px;
  color: var(--psi-chart-muted);
  font-size: 11px;
  line-height: 1.45;
}

.psi-chart-data {
  margin-top: auto;
  padding-top: 7px;
  color: var(--psi-chart-muted);
  font-size: 11px;
}

.psi-chart-data summary {
  cursor: pointer;
  width: fit-content;
  padding: 3px 2px;
  font-weight: 650;
}

.psi-chart-data summary:hover {
  color: var(--psi-chart-ink);
}

.psi-chart-data summary:focus-visible {
  outline: 2px solid var(--psi-chart-trend);
  outline-offset: 2px;
  border-radius: 2px;
}

.psi-chart-table-wrap {
  width: 100%;
  margin: 6px 0;
  overflow: auto;
  border: 1px solid var(--psi-chart-border);
  border-radius: 8px;
}

.psi-chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.psi-chart-table :is(th, td) {
  padding: 7px 8px;
  border-bottom: 1px solid var(--psi-chart-border);
}

.psi-chart-table thead th {
  color: var(--psi-chart-ink);
  background: var(--psi-chart-soft);
}

.psi-chart-table tbody th {
  font-weight: 550;
}

.psi-chart-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

@container psi-chart (max-width: 440px) {
  .psi-chart-svg {
    font-size: 18px;
  }
}

@container psi-chart (max-width: 330px) {
  .psi-chart-value strong {
    font-size: 27px;
  }

  .psi-chart-legend {
    min-height: 21px;
  }
}

@media (max-width: 460px) {
  .psi-chart {
    padding: 17px 15px 13px;
  }
}

:is([data-theme="dark"], .dark) .psi-chart {
  --psi-chart-surface: #22352a;
  --psi-chart-ink: #f4f4e8;
  --psi-chart-muted: #c0cebb;
  --psi-chart-border: #43564a;
  --psi-chart-grid: #44584a;
  --psi-chart-completed: #a8c392;
  --psi-chart-missed: #dd9a7e;
  --psi-chart-trend: #b4ce9a;
  --psi-chart-soft: #364e3e;
}
