:root {
  --panel-strong: rgba(255, 255, 255, 0.08);
  --pill: rgba(45, 139, 255, 0.15);
  --bar: linear-gradient(90deg, rgba(45, 139, 255, 0.9), rgba(76, 194, 127, 0.9));
}

body.is-loading [data-skeleton] {
  color: transparent;
  position: relative;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.segmented {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.seg-btn.is-active {
  background: var(--pill);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(45, 139, 255, 0.4);
}

.export-group {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.stats-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-meta {
  color: var(--muted);
  font-size: 12px;
}

.visual-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.list-card {
  min-height: 280px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-row {
  display: grid;
  gap: 8px;
}

.list-title {
  font-weight: 600;
  font-size: 14px;
}

.list-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  background: var(--bar);
  border-radius: inherit;
}

.table {
  margin-top: 20px;
}

.table-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.table-title {
  font-weight: 600;
  font-size: 16px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  min-width: 220px;
}

.table-hint {
  color: var(--muted);
  font-size: 12px;
}

.table-header {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-bottom: 8px;
}

.th-btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.th-btn.right {
  text-align: right;
}

.sort {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.sort.up {
  border-bottom: 6px solid var(--muted);
}

.sort.down {
  border-top: 6px solid var(--muted);
}

.table-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  margin-bottom: 8px;
}

.table-row:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.cell.right {
  text-align: right;
}

.col-id {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.table-skeleton {
  display: grid;
  gap: 8px;
}

.empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    width: 100%;
    justify-content: space-between;
  }

  .segmented {
    flex-wrap: wrap;
  }

  .stats-grid,
  .visual-grid {
    grid-template-columns: 1fr;
  }

  .table-tools {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .search {
    width: 100%;
  }
}