:root {
  --ink: #1f2328;
  --muted: #656d76;
  --border: #d0d7de;
  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-inset: #eff2f5;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --success: #1a7f37;
  --danger: #cf222e;
  --warning: #9a6700;
  --shadow: 0 1px 0 rgba(31, 35, 40, 0.04);
  --radius: 6px;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: #0d1117;
  color: #f0f6fc;
  border-bottom: 1px solid #30363d;
}
.topbar a { color: #f0f6fc; text-decoration: none; }
.topbar a:hover { color: #fff; text-decoration: none; }
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}
.brand img { height: 28px; width: auto; }
.top-search {
  flex: 1;
  max-width: 420px;
}
.top-search input {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  color: #f0f6fc;
  border-radius: var(--radius);
  padding: 0.4rem 0.7rem;
  font: inherit;
}
.top-nav { display: flex; align-items: center; gap: 0.85rem; font-size: 0.92rem; }
.top-nav .btn { color: #0d1117; }

.shell { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.lede { color: var(--muted); margin: 0.35rem 0 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--bg-inset); text-decoration: none; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.flash.ok { background: #dafbe1; border-color: #4ac26b66; color: var(--success); }
.flash.err { background: #ffebe9; border-color: #ff818266; color: var(--danger); }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.panel-hd {
  padding: 0.7rem 1rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-bd { padding: 1rem; }

.repo-list { list-style: none; margin: 0; padding: 0; }
.repo-list li {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.repo-list li:last-child { border-bottom: 0; }
.repo-title { font-size: 1.1rem; font-weight: 600; }
.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.lang-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.tabs {
  display: flex;
  gap: 0.15rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
}
.tabs a {
  color: var(--ink);
  padding: 0.65rem 0.9rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-size: 0.92rem;
}
.tabs a:hover { color: var(--ink); text-decoration: none; background: var(--bg-subtle); }
.tabs a.is-active {
  border-bottom-color: #fd8c73;
  font-weight: 600;
}

.repo-hero {
  padding: 0.25rem 0 1rem;
}
.repo-hero .path {
  font-size: 1.25rem;
  font-weight: 400;
}
.repo-hero .path strong { font-weight: 600; }
.repo-hero .desc { color: var(--muted); margin: 0.4rem 0 0.75rem; }
.repo-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.file-table { width: 100%; border-collapse: collapse; }
.file-table td {
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}
.file-table tr:hover td { background: var(--bg-subtle); }
.file-ico { color: var(--muted); width: 1.4rem; display: inline-block; }
.breadcrumb { color: var(--muted); margin-bottom: 0.75rem; font-size: 0.95rem; }
.breadcrumb a { font-weight: 600; }

.code-view {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  background: var(--bg);
  overflow: auto;
  margin: 0;
  padding: 1rem;
  white-space: pre;
}
.markdown-body {
  padding: 1.25rem 1.5rem;
  max-width: 900px;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.2em; }
.markdown-body pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.markdown-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(175, 184, 193, 0.2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.diff {
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: pre;
  overflow: auto;
  background: #f6f8fa;
  padding: 1rem;
  margin: 0;
}
.diff .add { background: #dafbe1; }
.diff .del { background: #ffebe9; }

label { display: block; font-weight: 550; margin: 0.85rem 0 0.35rem; font-size: 0.9rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search],
select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}
textarea { min-height: 140px; resize: vertical; font-family: var(--mono); font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.35rem 0 0; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .top-search { display: none; }
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: linear-gradient(180deg, #fff 0%, var(--bg-subtle) 100%);
}
.stat-box strong { display: block; font-size: 1.5rem; letter-spacing: -0.03em; }
.stat-box span { color: var(--muted); font-size: 0.85rem; }

.issue-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.issue-row:last-child { border-bottom: 0; }
.state-open { color: var(--success); }
.state-closed { color: var(--danger); }
.state-merged { color: #8250df; }
.badge {
  display: inline-block;
  padding: 0 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid transparent;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.3rem; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(9, 105, 218, 0.12), transparent 50%),
    radial-gradient(800px 300px at 90% 0%, rgba(26, 127, 55, 0.08), transparent 45%),
    var(--bg-subtle);
}
.auth-card {
  width: min(420px, calc(100% - 2rem));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
}
.auth-card h1 { margin: 0.5rem 0; font-size: 1.35rem; }
.auth-logo { height: 36px; }
.auth-card .btn { width: 100%; margin-top: 1rem; }

.explore-hero {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin-bottom: 1.5rem;
  background:
    linear-gradient(135deg, rgba(9, 105, 218, 0.08), transparent 45%),
    linear-gradient(0deg, var(--bg-subtle), #fff);
  position: relative;
  overflow: hidden;
}
.explore-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(31, 35, 40, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.45;
  pointer-events: none;
}
.explore-hero > * { position: relative; z-index: 1; }
.explore-hero .brand-hero {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 0;
}
.explore-hero p { color: var(--muted); max-width: 40rem; font-size: 1.05rem; }

.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.kanban-col {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
  min-height: 200px;
}
.kanban-col h3 { margin: 0 0 0.65rem; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.comment {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
  overflow: hidden;
}
.comment-hd {
  background: var(--bg-subtle);
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.comment-bd { padding: 0.85rem; }

.empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  background: var(--bg);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.shell > * { animation: rise 0.35s ease both; }
.shell > *:nth-child(2) { animation-delay: 0.05s; }
.shell > *:nth-child(3) { animation-delay: 0.1s; }

.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0 0.55rem;
}
.captcha-image {
  border: 1px solid var(--border);
  background: #fff;
  line-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
}
.captcha-image svg { display: block; }
.captcha-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.2rem;
  border-radius: var(--radius);
}
.captcha-refresh:hover { color: var(--accent); text-decoration: none; }

.health-panel .panel-hd {
  gap: 0.75rem;
}
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.health-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.health-healthy { background: #dafbe1; color: var(--success); }
.health-warning { background: #fff8c5; color: var(--warning); }
.health-critical { background: #ffebe9; color: var(--danger); }

.health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}
.health-card {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff 0%, var(--bg-subtle) 100%);
  min-width: 0;
}
.health-card-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.health-card-value {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--ink);
  word-break: break-word;
}
.health-card-value-sm { font-size: 1.15rem; }
.health-card-value-sm span {
  color: var(--muted);
  font-weight: 550;
  font-size: 0.95rem;
}
.health-card-meta {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.health-bar {
  margin-top: 0.65rem;
  height: 6px;
  background: #e8eef5;
  border-radius: 999px;
  overflow: hidden;
}
.health-bar > div { height: 100%; border-radius: 999px; }
.health-bar-ok { background: var(--success); }
.health-bar-warn { background: #d4a72c; }
.health-bar-crit { background: var(--danger); }

.health-services {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.health-services-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.25rem;
}
.health-svc {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.82rem;
  font-weight: 550;
  color: var(--ink);
}
.health-svc em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}
.health-svc-ok {
  border-color: #4ac26b66;
  background: #f6fbf7;
  color: var(--success);
}
.health-svc-ok em { color: var(--success); }
.health-svc-bad {
  border-color: #ff818266;
  background: #fff8f7;
  color: var(--danger);
}
.health-svc-bad em { color: var(--danger); }

.health-footnote {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.health-footnote-bad { color: var(--danger); }

@media (max-width: 1100px) {
  .health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .health-grid { grid-template-columns: 1fr; }
}
