* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f6f7fb;
  color: #111827;
}

header.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #d7dbe7;
  background: #ffffff;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

header p {
  margin-top: 4px;
  color: #5b6478;
}

.status {
  padding: 8px 12px;
  border-radius: 8px;
  background: #e8eefc;
  color: #274690;
  font-size: 14px;
}

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

.hidden {
  display: none !important;
}

.logout {
  min-height: 34px;
}

.login-screen {
  min-height: calc(100vh - 74px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid #d7dbe7;
  border-radius: 8px;
  background: #fff;
}

.login-error {
  min-height: 18px;
  color: #b91c1c;
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px 24px;
}

.panel {
  background: #fff;
  border: 1px solid #d7dbe7;
  border-radius: 8px;
  padding: 16px;
}

.panel h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #374151;
}

.field-hint {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.35;
}

input, select, button, textarea {
  font: inherit;
}

input, select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cfd6e6;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.checkbox {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
}

.full {
  grid-column: 1 / -1;
}

.checkbox input {
  width: 16px;
  height: 16px;
}

.config-info {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.config-info div {
  padding: 10px;
  border-radius: 6px;
  background: #f8fafc;
  color: #374151;
  font-size: 13px;
}

.config-info strong {
  display: block;
  color: #111827;
  margin-bottom: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

button {
  min-height: 38px;
  border: 1px solid #cfd6e6;
  border-radius: 6px;
  background: #fff;
  padding: 0 14px;
  cursor: pointer;
}

button.primary {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.summary {
  margin-bottom: 12px;
  color: #4b5563;
  font-size: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.repo-card {
  border: 1px solid #d7dbe7;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  background: #fff;
}

.repo-card:hover {
  border-color: #93b4f6;
  background: #f8fbff;
}

.repo-card-head,
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.repo-card-head > div:first-child {
  min-width: 0;
}

.repo-card-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 150px;
}

.repo-card h3,
.detail-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.repo-card a,
.detail-head a {
  color: #2563eb;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.repo-card p,
.repo-summary,
.detail-body {
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.repo-meta span,
.star-badge,
.repo-added-at {
  background: #eef2ff;
  border-radius: 999px;
  color: #334155;
  font-size: 12px;
  padding: 4px 8px;
}

.repo-added-at {
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  z-index: 10;
}

.modal {
  position: relative;
  width: min(820px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 20px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  padding: 0;
  font-size: 22px;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  margin-top: 12px;
}

.meta div {
  padding: 10px;
  background: #f8fafc;
  border-radius: 6px;
}

.meta strong {
  display: block;
  margin-bottom: 4px;
}

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

  .grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) and (min-width: 961px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
