:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --text: #172033;
  --muted: #647084;
  --line: #dbe2ee;
  --panel: #ffffff;
  --accent: #176b87;
  --ok: #177245;
  --error: #b42318;
  --notice: #b54708;
  --news: #175cd3;
  --career: #087443;
  --publicity: #c11574;
  --academic: #6941c6;
  --admission: #9f580a;
  --other: #475467;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px 36px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

p {
  margin-top: 8px;
  color: var(--muted);
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 16px;
}

.metric-card {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  display: block;
  padding: 18px;
  text-align: left;
  width: 100%;
}

.metric-card:hover {
  border-color: #9dbac3;
  box-shadow: 0 8px 24px rgba(23, 107, 135, 0.08);
  text-decoration: none;
}

.metric-card:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(23, 107, 135, 0.25);
  outline-offset: 2px;
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

main {
  padding: 24px 36px 48px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metrics div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metrics div {
  padding: 18px;
}

.metrics span,
.metric-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.metrics strong,
.metric-card strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.metrics strong a {
  color: inherit;
}

.scan-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid #98a2b3;
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 24px;
  padding: 18px 20px;
}

.scan-card.is-hidden,
.panel.is-collapsed {
  display: none;
}

.scan-card.starting,
.scan-card.channels,
.scan-card.parse,
.scan-card.collection,
.scan-card.home,
.scan-card.notify {
  background: #101828;
  border-color: #101828;
  border-left-color: #7cd4fd;
  color: #ffffff;
}

.scan-card.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: var(--ok);
}

.scan-card.failed {
  background: #fff7f6;
  border-color: #f8c9c4;
  border-left-color: var(--error);
}

.scan-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.scan-row strong,
.scan-row span {
  display: block;
}

.scan-row strong {
  font-size: 16px;
}

.scan-row span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.scan-card.starting .scan-row span,
.scan-card.channels .scan-row span,
.scan-card.parse .scan-row span,
.scan-card.collection .scan-row span,
.scan-card.home .scan-row span,
.scan-card.notify .scan-row span {
  color: #cbd5e1;
}

.scan-pill {
  background: #344054;
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  text-transform: uppercase;
}

.scan-pill.active {
  background: #0e9384;
}

.scan-card.done .scan-pill {
  background: #d1fadf;
  color: var(--ok);
}

.scan-card.failed .scan-pill {
  background: #fdecec;
  color: var(--error);
}

.progress {
  background: #e4e7ec;
  border-radius: 999px;
  height: 8px;
  margin: 16px 0 12px;
  overflow: hidden;
}

.progress div {
  background: #98a2b3;
  border-radius: inherit;
  height: 100%;
  transition: width 240ms ease;
}

.scan-card.starting .progress,
.scan-card.channels .progress,
.scan-card.parse .progress,
.scan-card.collection .progress,
.scan-card.home .progress,
.scan-card.notify .progress {
  background: #344054;
}

.scan-card.starting .progress div,
.scan-card.channels .progress div,
.scan-card.parse .progress div,
.scan-card.collection .progress div,
.scan-card.home .progress div,
.scan-card.notify .progress div {
  background: #7cd4fd;
}

.scan-card.done .progress div {
  background: var(--ok);
}

.scan-card.failed .progress div {
  background: var(--error);
}

.scan-result {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-result span {
  background: #f2f4f7;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  padding: 5px 10px;
}

.scan-result b {
  color: var(--text);
}

.scan-card.starting .scan-result span,
.scan-card.channels .scan-result span,
.scan-card.parse .scan-result span,
.scan-card.collection .scan-result span,
.scan-card.home .scan-result span,
.scan-card.notify .scan-result span {
  background: #344054;
  color: #d0d5dd;
}

.scan-card.starting .scan-result b,
.scan-card.channels .scan-result b,
.scan-card.parse .scan-result b,
.scan-card.collection .scan-result b,
.scan-card.home .scan-result b,
.scan-card.notify .scan-result b {
  color: #ffffff;
}

.panel {
  margin-bottom: 24px;
  padding: 20px;
}

.section-head,
.site-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head span,
.site-card-head small {
  color: var(--muted);
  font-size: 13px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.site-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.site-card-head a {
  color: var(--text);
  font-weight: 800;
}

.channel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.channel-tag {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  max-width: 100%;
  padding: 5px 9px;
  word-break: break-word;
}

.channel-tag:hover {
  text-decoration: none;
}

.channel-tag span,
.mini-tag {
  border-radius: 999px;
  color: #ffffff;
  display: inline-block;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  padding: 4px 6px;
}

.channel-tag.notice {
  background: #fffaeb;
  border-color: #fedf89;
  color: var(--notice);
}

.channel-tag.news {
  background: #eff8ff;
  border-color: #b2ddff;
  color: var(--news);
}

.channel-tag.career {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--career);
}

.channel-tag.publicity {
  background: #fdf2fa;
  border-color: #fcceee;
  color: var(--publicity);
}

.channel-tag.academic {
  background: #f4f3ff;
  border-color: #d9d6fe;
  color: var(--academic);
}

.channel-tag.admission {
  background: #fff6ed;
  border-color: #ffd6ae;
  color: var(--admission);
}

.channel-tag.other {
  background: #f2f4f7;
  border-color: #d0d5dd;
  color: var(--other);
}

.channel-tag.notice span,
.mini-tag.notice {
  background: var(--notice);
}

.channel-tag.news span,
.mini-tag.news {
  background: var(--news);
}

.channel-tag.career span,
.mini-tag.career {
  background: var(--career);
}

.channel-tag.publicity span,
.mini-tag.publicity {
  background: var(--publicity);
}

.channel-tag.academic span,
.mini-tag.academic {
  background: var(--academic);
}

.channel-tag.admission span,
.mini-tag.admission {
  background: var(--admission);
}

.channel-tag.other span,
.mini-tag.other {
  background: var(--other);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 980px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.status.ok {
  background: #e8f5ee;
  color: var(--ok);
}

.status.error {
  background: #fdecec;
  color: var(--error);
}

.error-text {
  color: var(--error);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 7px;
  max-width: 280px;
  word-break: break-word;
}

.error-list {
  display: grid;
  gap: 10px;
}

.error-item {
  border: 1px solid #f8c9c4;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  grid-template-columns: 100px 220px 1fr;
  gap: 12px;
  padding: 12px;
}

.error-item:hover {
  background: #fff7f6;
  text-decoration: none;
}

.error-item span {
  color: var(--error);
  font-size: 12px;
  font-weight: 800;
}

.error-item strong {
  font-size: 14px;
}

.error-item small {
  color: var(--muted);
  word-break: break-word;
}

.recent {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent li {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 110px 1fr 220px;
  gap: 14px;
  padding: 12px 0;
}

.recent small,
.recent span {
  color: var(--muted);
}

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

  main {
    padding: 14px;
  }

  h1 {
    font-size: 20px;
  }

  h2 {
    font-size: 16px;
  }

  .metrics {
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
  }

  .metrics div,
  .metric-card {
    padding: 12px;
  }

  .metrics span,
  .metric-card span {
    font-size: 12px;
  }

  .metrics strong,
  .metric-card strong {
    font-size: 24px;
  }

  .scan-card,
  .panel {
    margin-bottom: 14px;
    padding: 14px;
  }

  .scan-row {
    align-items: flex-start;
    flex-direction: column;
  }

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

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
  }

  td {
    border-bottom: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: 72px 1fr;
    padding: 7px 0;
  }

  td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 800;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .error-text {
    max-width: none;
  }

  .error-item,
  .recent li {
    grid-template-columns: 1fr;
  }

  .section-head,
  .site-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
