/* Tables (cards below 720px), definition lists, empty/loading/error states and the usage chart. */

/* ===== TABLES (cards below 720px) ===== */
.tbl-wrap {
  min-width: 0;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  padding: 6px 10px;
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.tbl td {
  padding: 8px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--hair);
}
.tbl th:first-child,
.tbl td:first-child {
  padding-left: 0;
}
.tbl th:last-child,
.tbl td:last-child {
  padding-right: 0;
}
.tbl .num {
  text-align: right;
}
.tbl .act {
  text-align: right;
  width: 1%;
  white-space: nowrap;
}
@media (hover: hover) {
  .tbl tbody tr:hover {
    background: var(--tint);
  }
}
.tbl select.input {
  min-height: 28px;
  padding: 2px 26px 2px 8px;
  width: auto;
}
.cell-link {
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
  text-decoration: none;
}
a.cell-link strong {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a.cell-link:hover strong {
  text-decoration-color: currentColor;
}
.cell-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  overflow-wrap: anywhere;
}
.cell-sub--bad {
  color: var(--accent-ink);
}
.cell-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.action {
  font-size: 12px;
  font-weight: 600;
}
@media (max-width: 720px) {
  .tbl thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .tbl,
  .tbl tbody,
  .tbl tr,
  .tbl td {
    display: block;
    width: 100%;
  }
  .tbl tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--hair);
  }
  .tbl td {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: 10px;
    padding: 3px 0;
    border: 0;
    text-align: left;
  }
  .tbl td::before {
    content: attr(data-label);
    padding-top: 2px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .tbl td:first-child {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 6px;
  }
  .tbl td:first-child::before,
  .tbl td[data-label=""]::before {
    display: none;
  }
  .tbl td[data-label=""] {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 6px;
  }
  .tbl .num,
  .tbl .act {
    text-align: left;
    width: 100%;
  }
  .tbl td > * {
    justify-self: start;
  }
}

/* ===== DEFINITION LISTS ===== */
.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0 18px;
}
.kv__row {
  display: contents;
}
.kv dt,
.kv dd {
  padding: 7px 0;
  border-bottom: 1px solid var(--hair);
}
.kv dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 9px;
}
.kv dd {
  overflow-wrap: anywhere;
}

/* ===== STATES ===== */
.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 0;
}
.state--loading {
  flex-direction: row;
  align-items: center;
  color: var(--muted);
}
.state--empty {
  padding: 20px;
  border: 1px dashed var(--input-border);
  background: var(--surface);
}
.state--empty .cmd {
  align-self: stretch;
}
.state__title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
}
.state__text {
  max-width: 70ch;
  color: var(--muted);
}
.state--error {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  background: var(--accent-tint);
}
.state--error .icon {
  color: var(--accent-ink);
}
.state--error p {
  flex: 1 1 240px;
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--hair);
  border-top-color: var(--fg);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.steps {
  counter-reset: step;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--hair);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  font-weight: 600;
  color: var(--accent-ink);
}
.notice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 12px;
  border-left: 3px solid var(--fg);
  background: var(--tint);
}
.notice--bad {
  border-left-color: var(--accent);
  background: var(--accent-tint);
}
.notice .icon {
  flex: none;
  margin-top: 2px;
}

/* ===== USAGE CHART (chart.js) ===== */
.chart {
  position: relative;
  min-width: 0;
  margin-top: 8px;
}
.chart__svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart__gridline {
  stroke: var(--hair);
  stroke-width: 1;
}
.chart__baseline {
  stroke: var(--rule);
  stroke-width: 1;
}
.chart__axis {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
}
.chart__hit {
  fill: transparent;
}
.chart__mark {
  fill: var(--fg);
}
.chart__zero {
  fill: var(--hair);
}
.chart__bar {
  outline: none;
  cursor: default;
}
.chart__bar.is-active .chart__mark,
.chart__bar:focus-visible .chart__mark {
  fill: var(--accent);
}
.chart__bar:focus-visible .chart__hit {
  stroke: var(--fg);
  stroke-width: 1.5;
}
.chart__empty {
  fill: var(--muted);
  font-size: 13px;
}
.chart__tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 6px 9px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  white-space: nowrap;
}
.chart__tip-title {
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0.8;
}
.chart__tip-value {
  font-weight: 700;
}
