:root {
  --hcy-gap: 16px;
  --hcy-live: #0b57d0;
  --hcy-dead: #b91c1c;
  --hcy-total: #1f2937;
  --hcy-warn: #a16207;
  --hcy-err: #b91c1c;
}

.hcy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--hcy-gap);
}

@media (min-width: 980px) {
  .hcy-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
  .hcy-grid > section.card:nth-of-type(1) {
    grid-column: 1 / -1;
  }
}

.hcy-field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.hcy-inline > span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.hcy-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hcy-actions--tight {
  margin-top: 10px;
}

.hcy-check input {
  margin-right: 8px;
}

.hcy-table {
  width: 100%;
  border-collapse: collapse;
}

.hcy-table th,
.hcy-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  vertical-align: middle;
}

.hcy-table .input {
  min-height: 40px;
  padding: 10px 10px;
}

.hcy-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hcy-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.hcy-summary-item {
  background: #f7f9fb;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.hcy-summary-label {
  font-size: 0.9rem;
  color: #4b5563;
}

.hcy-summary-value {
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.hcy-msg {
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
}

.hcy-msg--error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--hcy-err);
}

.hcy-msg--warn {
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: var(--hcy-warn);
}

.hcy-msg-list {
  margin: 0;
  padding-left: 18px;
}

.hcy-share {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.hcy-h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.hcy-chart {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.hcy-chart-scale {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: end;
  padding-bottom: 2px;
}

.hcy-scale-bars {
  position: relative;
  height: 18px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1;
}

.hcy-tick-label {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.hcy-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.hcy-bar-label {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hcy-bars {
  position: relative;
  height: 14px;
  background: #eef2f7;
  border-radius: 9999px;
  overflow: hidden;
}

.hcy-bars-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hcy-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in oklab, #94a3b8 45%, transparent 55%);
}

.hcy-mean-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 0;
  border-left: 2px dashed color-mix(in oklab, #0f172a 55%, transparent 45%);
}

.hcy-bar {
  height: 100%;
  border-radius: 9999px;
}

.hcy-bar--total {
  background: color-mix(in oklab, var(--hcy-total) 70%, #ffffff 30%);
}

.hcy-bar--stack {
  display: flex;
  overflow: hidden;
  background: transparent;
}

.hcy-seg {
  height: 100%;
}

.hcy-seg--live {
  background: color-mix(in oklab, var(--hcy-live) 75%, #ffffff 25%);
}

.hcy-seg--dead {
  background: color-mix(in oklab, var(--hcy-dead) 70%, #ffffff 30%);
}

.hcy-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: #334155;
  white-space: nowrap;
}

.hcy-paste textarea {
  width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .hcy-bar-label {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }
  .hcy-bar-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
  .hcy-bar-value {
    grid-column: 1 / -1;
    text-align: left;
    white-space: normal;
    color: #475569;
  }
  .hcy-chart-scale {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}
