.history-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0;
}

.history-block .result-table {
  overflow: hidden;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.history-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.history-card__icon {
  width: 1.5em;
  height: 1.5em;
  flex-shrink: 0;
}

.history-th-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.history-cols6,
.history-cols5 {
  width: 100%;
}

/* 上组：ASN + 企业，6 列 */
.history-cols6 .history-row {
  display: grid;
  grid-template-columns: 120px 130px 1fr 110px 168px 168px;
}

.history-cols6 .c-left3 {
  grid-column: 1 / 4;
}

/* 下组：注册地 + 位置，5 列 */
.history-cols5 .history-row {
  display: grid;
  grid-template-columns: 130px 1fr minmax(110px, 1.2fr) 168px 168px;
}

.history-cols5 .c-country,
.history-cols5 .c-center {
  grid-column: 3;
}

.history-cols5 .c-time {
  grid-column: 5;
}

.history-cell.c-mid,
.history-cols5 .c-country,
.history-cols5 .c-center,
.history-cols5 .c-time {
  text-align: center;
}

.history-cell.c-mid .history-country,
.history-cell.c-mid .history-date,
.history-cols5 .c-country .history-country,
.history-cols5 .c-center .history-country {
  display: inline-flex;
  justify-content: center;
}

.history-cell.c-mid .history-date {
  display: inline-flex;
}

.history-row--inactive .history-cell {
  background: #fafafa;
}

.history-cols6 .history-row:not(.history-head):not(.history-row--msg):not(.history-row--inactive) .history-cell {
  background: #fff;
}

.history-asn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.history-asn-status {
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
}

.history-cell {
  padding: 0.85rem 1rem;
  border-top: 1px solid #f1f5f9;
  color: #334155;
  line-height: 1.55;
  min-width: 0;
}

.history-head {
  background: #f9f9ff;
  border-bottom: 1px solid #f9f9ff;
}

.history-head .history-cell {
  background: transparent;
  color: #64748b;
  font-weight: 500;
  font-size: 13px;
  padding: 0.7rem 1rem;
  border-top: none;
  border-bottom: none;
  white-space: nowrap;
}

.history-head:first-child .history-cell {
  border-top: none;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
}

.result-head .history-cell {
  display: flex;
  align-items: center;
}

.result-head .result-head-action {
  margin-left: auto;
  flex-shrink: 0;
}

.history-row--msg .history-cell {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: #94a3b8;
}

.history-card a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.history-card a:hover {
  text-decoration: underline;
}

.history-cidr,
.history-date {
  white-space: nowrap;
}

.history-date {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-variant-numeric: tabular-nums;
}

.history-inline-icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: #94a3b8;
}

.history-country {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  white-space: nowrap;
}

.history-country__flag {
  height: 1em;
  width: 1.333em;
  border-radius: 2px;
  object-fit: contain;
}

.history-type-badge {
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 3px;
  margin-right: 6px;
  font-weight: 500;
}

.history-registry {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 500;
}

.history-skeleton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 13px;
}

.history-skeleton__dot {
  width: 14px;
  height: 14px;
  border: 2px solid #e2e8f0;
  border-top-color: #3794f8;
  border-radius: 50%;
  animation: history-spin 0.7s linear infinite;
}

@keyframes history-spin {
  to { transform: rotate(360deg); }
}

.history-empty {
  color: #94a3b8;
  font-size: 13px;
}

.history-fold {
  overflow-anchor: none;
}

.history-fold-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 34px;
  padding: 0;
  border: none;
  border-top: 1px solid #f1f5f9;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.history-fold.has-fold .history-fold-btn {
  display: flex;
}

.history-fold-btn:hover {
  background: #f8fafc;
}

.history-fold-btn .history-inline-icon {
  transition: transform 0.3s ease;
}

.history-fold.is-expanded .history-fold-btn .history-inline-icon {
  transform: rotate(180deg);
}

.history-fold.has-fold:not(.is-expanded) .history-row--extra {
  display: none;
}

@media (max-width: 768px) {
  .history-card {
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
  }

  .history-cols6,
  .history-cols5 {
    min-width: 0;
  }

  .history-cols6 .history-row.history-head,
  .history-cols5 .history-row.history-head {
    display: flex;
    align-items: center;
    min-width: 0;
    grid-template-columns: none;
  }

  .history-head .history-cell {
    display: none;
    white-space: normal;
  }

  .history-head .history-cell:first-child {
    display: flex;
    width: 100%;
    padding: 0.7rem 0.65rem;
  }

  .result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .result-head .history-cell,
  .result-head.history-head .history-cell:first-child {
    display: flex;
    align-items: center;
    width: auto;
    padding: 0.7rem 0.65rem;
  }

  .result-head .history-cell:first-child {
    flex: 1;
    min-width: 0;
  }

  .result-head .result-head-action {
    margin-left: auto;
    flex-shrink: 0;
    width: auto;
    padding-left: 0;
  }

  .history-cols6 .history-row.history-kind-asn,
  .history-cols6 .history-row.history-kind-company,
  .history-cols5 .history-row.history-kind-registry,
  .history-cols5 .history-row.history-kind-location {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    min-width: 0;
    padding: 14px 16px;
    border-top: 1px solid #f1f5f9;
    text-align: left;
  }

  .history-row--inactive {
    background: #fafafa;
  }

  .history-kind-asn .history-cell,
  .history-kind-company .history-cell,
  .history-kind-registry .history-cell,
  .history-kind-location .history-cell {
    padding: 0;
    border: none;
    background: transparent;
    width: auto;
    text-align: left;
    white-space: normal;
    grid-column: auto;
  }

  .history-kind-asn {
    grid-template-areas:
      "title meta"
      "info info"
      "place place"
      "first last";
  }

  .history-kind-asn .history-cell:nth-child(1) { grid-area: title; }
  .history-kind-asn .history-cell:nth-child(2) { grid-area: meta; }
  .history-kind-asn .history-cell:nth-child(3) { grid-area: info; }
  .history-kind-asn .history-cell:nth-child(4) { grid-area: place; }
  .history-kind-asn .history-cell:nth-child(5) { grid-area: first; }
  .history-kind-asn .history-cell:nth-child(6) { grid-area: last; }

  .history-kind-company {
    grid-template-areas:
      "title meta"
      "first last";
  }

  .history-kind-company .history-cell:nth-child(1) { grid-area: title; }
  .history-kind-company .history-cell:nth-child(2) { grid-area: meta; }
  .history-kind-company .history-cell:nth-child(3) { grid-area: first; }
  .history-kind-company .history-cell:nth-child(4) { grid-area: last; }

  .history-kind-registry {
    grid-template-areas:
      "title meta"
      "place place"
      "first last";
  }

  .history-kind-registry .history-cell:nth-child(1) { grid-area: title; }
  .history-kind-registry .history-cell:nth-child(2) { grid-area: meta; }
  .history-kind-registry .history-cell:nth-child(3) { grid-area: place; }
  .history-kind-registry .history-cell:nth-child(4) { grid-area: first; }
  .history-kind-registry .history-cell:nth-child(5) { grid-area: last; }

  .history-kind-location {
    grid-template-areas:
      "title title"
      "place place"
      "time time";
  }

  .history-kind-location .history-cell:nth-child(1) { grid-area: title; }
  .history-kind-location .history-cell:nth-child(2) { grid-area: place; }
  .history-kind-location .history-cell:nth-child(3) { grid-area: time; }

  .history-kind-asn .history-cell:nth-child(1),
  .history-kind-company .history-cell:nth-child(1),
  .history-kind-registry .history-cell:nth-child(1),
  .history-kind-location .history-cell:nth-child(1) {
    font-size: 15px;
    color: #0f172a;
  }

  .history-kind-asn .history-cell:nth-child(2),
  .history-kind-company .history-cell:nth-child(2),
  .history-kind-registry .history-cell:nth-child(2) {
    color: #64748b;
    font-size: 13px;
    justify-self: end;
    text-align: right;
  }

  .history-cidr,
  .history-date {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .history-cell.c-mid .history-country,
  .history-cell.c-mid .history-date,
  .history-cols5 .c-country .history-country,
  .history-cols5 .c-center .history-country {
    justify-content: flex-start;
  }

  .history-cell--first,
  .history-cell.c-mid.history-cell--first {
    justify-self: start;
    text-align: left;
    width: max-content;
    max-width: 100%;
  }

  .history-cell--last,
  .history-cell.c-mid.history-cell--last {
    justify-self: end;
    text-align: left;
    width: max-content;
    max-width: 100%;
  }

  .history-cell--first .history-date,
  .history-cell--last .history-date {
    justify-content: flex-start;
  }

  .history-cell--first::before,
  .history-cell--last::before,
  .history-cell--time::before {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
  }

  .history-cell--first::before { content: '首次出现'; }
  .history-cell--last::before { content: '最近活跃'; }
  .history-cell--time::before { content: '时间'; }

  .history-cols6 .history-row.history-row--msg,
  .history-cols5 .history-row.history-row--msg {
    display: block;
    min-width: 0;
    grid-template-columns: none;
  }

  .history-row--msg .history-cell {
    grid-column: auto;
  }
}
