:root {
  --bg: #eceff3;
  --panel: #f7f9fb;
  --card: #ffffff;
  --line: #d6dde6;
  --text: #1f2b3a;
  --muted: #64748b;
  --primary: #1f6feb;
  --primary-soft: #e8f1ff;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(18, 28, 45, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f2f4f8 0%, #e8edf4 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

.page {
  width: min(960px, 94vw);
  margin: 24px auto 48px;
}

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

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

.title-wrap h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.title-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d5ad4;
  border: 1px solid #b9d2ff;
  border-radius: 8px;
  background: #e9f1ff;
  font-size: 12px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  color: #3d4c60;
}

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

.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.tab-btn {
  border: 0;
  background: transparent;
  color: #3b4b60;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.custom-days {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.custom-days input {
  width: 88px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(420px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.list-panel {
  min-height: calc(100vh - 200px);
}

.panel-head {
  padding: 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 30px;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.rank-list {
  padding: 14px;
}

.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.rank-item:hover {
  background: #f1f7ff;
  border-color: #c8dcff;
  transform: translateY(-1px);
}

.rank-item.active {
  background: #e7f2ff;
  border-color: #bfd7fd;
}

.rank-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge {
  min-width: 42px;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #435268;
  font-size: 13px;
  font-weight: 700;
  background: #f8fafc;
}

.rank-name {
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #f9fbfd;
  color: #314155;
  font-size: 13px;
  font-weight: 600;
}

.panel-foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-num {
  min-width: 36px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  cursor: pointer;
}

.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #2d3a4c;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}

.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.detail-pane {
  position: sticky;
  top: 16px;
}

.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f4f7fb;
  padding: 16px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h3 {
  margin: 0;
  font-size: 30px;
}

.detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.link-row {
  display: flex;
  gap: 10px;
  padding: 16px 0 10px;
}

.link-row a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  color: #1f2b3a;
  text-decoration: none;
  font-size: 14px;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 14px;
}

.desc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  margin: 0;
  color: #4f5f74;
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 6px;
}

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

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  margin-top: 12px;
}

.detail-section h4 {
  margin: 0;
  font-size: 24px;
}

.hint {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.chart {
  width: 100%;
  height: 240px;
  background: linear-gradient(180deg, #fcfdff 0%, #f6f9fd 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.urls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.url-groups {
  display: grid;
  gap: 10px;
}

.url-date-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.url-date-group h5 {
  margin: 0 0 10px;
  font-size: 18px;
}

.domain-block {
  margin-bottom: 8px;
}

.domain-title {
  margin: 0 0 6px;
  font-weight: 700;
}

.url-list {
  margin: 0;
  padding-left: 20px;
}

.url-list li {
  margin: 3px 0;
}

.url-list a {
  color: #0a58c9;
  text-decoration: none;
  word-break: break-all;
}

.empty {
  padding: 42px 14px;
  text-align: center;
  color: var(--muted);
}

.filters-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.input-like {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #1f2b3a;
  padding: 9px 10px;
  min-height: 36px;
}

.input-like.grow {
  flex: 1;
  min-width: 180px;
}

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

.hint-inline.hint-error {
  color: #b42318;
}

.hint-inline.hint-success {
  color: #027a48;
}

.custom-panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  margin-bottom: 12px;
  overflow: hidden;
}

.custom-panel.visible {
  display: block;
}

.custom-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.custom-panel-head h3 {
  margin: 0;
  font-size: 22px;
}

.custom-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.custom-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 14px 16px 10px;
}

.custom-field {
  display: grid;
  gap: 6px;
}

.custom-field span {
  font-size: 13px;
  color: #3f4f65;
}

.custom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 14px;
}

.primary-btn {
  border: 1px solid #0b61dc;
  border-radius: 8px;
  background: #1f6feb;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.jump-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.jump-input {
  width: 72px;
  padding: 7px 8px;
}

@media (max-width: 900px) {
  .title-wrap h1 {
    font-size: 28px;
  }

  .panel-head h2,
  .detail-head h3 {
    font-size: 24px;
  }

  .rank-name,
  .detail-section h4 {
    font-size: 20px;
  }

  .stat-card strong {
    font-size: 28px;
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .list-panel {
    min-height: auto;
  }

  .detail-pane {
    position: static;
  }

  .detail-card {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

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

  .rank-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .rank-right {
    width: 100%;
    justify-content: flex-start;
  }

  .panel-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .custom-grid {
    grid-template-columns: 1fr;
  }
}
