:root {
  --topbar-bg: #15181e;
  --topbar-fg: #e7ebf0;
  --page-bg: #000000;
  --card-bg: #111419;
  --border: #23272f;
  --text: #dde2e9;
  --text-dim: #8a939f;
  --text-mute: #5e6772;
  --accent: #19b886;
  --hover: #181c23;

  --s-success: #1cb95b;
  --s-failure: #e8453c;
  --s-running: #f4a935;
  --s-pending: #c2cad3;
  --s-killed: #95a0ad;
  --s-skipped: #aeb6c0;
  --s-blocked: #f4a935;
  --s-error: #e8453c;

  --log-bg: #1b1f27;
  --log-fg: #d3d8e0;
  --mono: ui-monospace, "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
.sep { color: var(--text-mute); margin: 0 .25em; font-weight: 400; }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* ---- top bar ---- */
.topbar {
  background: var(--topbar-bg);
  color: var(--topbar-fg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; }
.brand-logo { height: 30px; width: 30px; display: block; }
.crumbs { display: flex; align-items: center; font-size: 15px; }
.crumb { color: var(--topbar-fg); opacity: .92; }
.crumb.dim { opacity: .6; }
.account { display: flex; align-items: center; gap: 10px; }
.account-name { font-size: 13px; opacity: .85; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #3a4150; object-fit: cover; }
.avatar-sm { width: 20px; height: 20px; }

/* ---- generic ---- */
.content { flex: 1; padding-bottom: 60px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card-bg); border: 1px solid var(--border);
  color: var(--text); border-radius: 4px; padding: 6px 12px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--text-mute); }
.empty { padding: 40px; text-align: center; color: var(--text-dim); background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; text-transform: lowercase; }
.badge-private { background: #1b1f26; color: var(--text-dim); border: 1px solid var(--border); }

/* ---- dashboard / repo list ---- */
.list-toolbar { padding: 24px 0 14px; }
.search input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; background: var(--card-bg); color: var(--text);
}
.search input:focus { outline: none; border-color: var(--accent); }
.repo-list { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.repo-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.repo-item:last-child { border-bottom: none; }
.repo-item:hover { background: var(--hover); }
.repo-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.repo-name { font-size: 15px; }
.repo-name strong { font-weight: 600; }
.repo-desc { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.repo-meta { display: flex; align-items: center; gap: 14px; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.repo-branch { font-family: var(--mono); }

/* ---- repo header / tabs ---- */
.repo-header { background: var(--card-bg); border-bottom: 1px solid var(--border); }
.repo-header-inner { padding-top: 20px; }
.repo-title { font-size: 22px; font-weight: 500; margin: 0 0 10px; }
.tabs { display: flex; gap: 24px; }
.tab { padding: 10px 0; color: var(--text-dim); font-size: 14px; border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 500; }

/* ---- build list ---- */
.build-list { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.build-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-left-width: 4px; border-radius: 5px; padding: 14px 16px;
  transition: box-shadow .12s;
}
.build-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.5); border-color: #2e343d; border-left-color: inherit; }
.build-body { flex: 1; min-width: 0; }
.build-line1 { display: flex; align-items: baseline; gap: 10px; }
.build-number { color: var(--text-mute); font-family: var(--mono); font-size: 13px; }
.build-title { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.build-line2 { display: flex; align-items: center; gap: 16px; margin-top: 5px; color: var(--text-dim); font-size: 12.5px; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.ico { width: 13px; height: 13px; fill: currentColor; opacity: .8; }
.event { text-transform: lowercase; background: #1b1f26; padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.event-push { background: rgba(89,140,232,.15); color: #79a6f6; }
.event-pull_request { background: rgba(40,180,99,.15); color: #4ecb79; }
.event-schedule { background: rgba(150,110,220,.15); color: #b08ae8; }
.build-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: nowrap; }
.build-actor { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); }
.build-times { display: flex; gap: 12px; color: var(--text-dim); font-size: 12px; }

/* ---- branches ---- */
.branch-item { cursor: default; }
.branch-name { font-size: 14px; font-weight: 600; }
.branch-msg { max-width: 480px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-default { background: rgba(25,184,134,.15); color: var(--accent); border: 1px solid rgba(25,184,134,.35); }

/* status colored left borders */
.status-border-success { border-left-color: var(--s-success); }
.status-border-failure { border-left-color: var(--s-failure); }
.status-border-running { border-left-color: var(--s-running); }
.status-border-pending { border-left-color: var(--s-pending); }
.status-border-killed  { border-left-color: var(--s-killed); }
.status-border-skipped { border-left-color: var(--s-skipped); }
.status-border-blocked { border-left-color: var(--s-blocked); }
.status-border-error   { border-left-color: var(--s-error); }

/* ---- status icon ---- */
.status-icon {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; line-height: 1;
}
.status-success { background: var(--s-success); }
.status-failure { background: var(--s-failure); }
.status-running { background: var(--s-running); }
.status-pending { background: var(--s-pending); }
.status-killed  { background: var(--s-killed); }
.status-skipped { background: var(--s-skipped); }
.status-blocked { background: var(--s-blocked); }
.status-error   { background: var(--s-error); }

.spinner {
  width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.55);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- build detail ---- */
.build-detail-header { background: var(--card-bg); border-bottom: 1px solid var(--border); border-left: 4px solid var(--border); padding: 20px 0; }
.bdh-top { display: flex; align-items: center; gap: 12px; }
.bdh-title { font-size: 19px; font-weight: 500; margin: 0; flex: 1; }
.ext-link { color: var(--accent); font-size: 13px; }
.bdh-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; color: var(--text-dim); font-size: 13px; }

.build-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; margin-top: 22px; align-items: start; }

.stages { display: flex; flex-direction: column; gap: 12px; }
.stage { background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.stage-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  cursor: pointer; border-left: 3px solid transparent;
}
.stage-head:hover { background: var(--hover); }
.stage-head.active { background: rgba(25,184,134,.08); border-left-color: var(--accent); }
.stage-name { flex: 1; font-weight: 500; font-size: 13.5px; }
.stage-dur, .step-dur { color: var(--text-mute); font-size: 12px; font-family: var(--mono); }
.steps { border-top: 1px solid var(--border); }
.step { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 18px; font-size: 12.5px; color: var(--text-dim); }
.step .status-icon { width: 18px; height: 18px; font-size: 10px; }
.step-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- logs ---- */
.logs { background: var(--log-bg); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; min-height: 420px; }
.logs-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #23272f; border-bottom: 1px solid #2f343d; }
.logs-title { color: #c7ccd4; font-size: 13px; font-family: var(--mono); }
.logs-actions { display: flex; gap: 8px; }
.logs-actions .btn { background: #2f343d; border-color: #3a3f49; color: #c7ccd4; padding: 4px 10px; font-size: 12px; }
.logs-actions .btn:hover { border-color: #50566180; }
.log-output {
  margin: 0; padding: 14px 16px; color: var(--log-fg); font-family: var(--mono);
  font-size: 12.5px; line-height: 1.55; overflow: auto; white-space: pre;
  counter-reset: line; flex: 1; max-height: 70vh;
}
.log-output.wrap { white-space: pre-wrap; word-break: break-word; }
.log-output .ln { display: block; padding-left: 3.2em; position: relative; }
.log-output .ln::before {
  counter-increment: line; content: counter(line);
  position: absolute; left: 0; width: 2.6em; text-align: right;
  color: #565d68; user-select: none;
}
.log-placeholder { color: #6b7280; }
.log-error { color: var(--s-failure); }

/* workflow command markers (##[group], ##[error], …) */
.ln-group   { color: #8ab4f8; font-weight: 600; }
.ln-section { color: #8ab4f8; font-weight: 600; }
.ln-command { color: #7ee2b8; }
.ln-error   { color: #ff7b72; background: rgba(232,69,60,.12); }
.ln-warning { color: #f4a935; background: rgba(244,169,53,.10); }
.ln-notice  { color: #8ab4f8; }
.ln-debug   { color: #565d68; }
.ln-endgroup { display: none; }

/* ANSI SGR colors */
.a-bold    { font-weight: 700; }
.a-black   { color: #565d68; }
.a-red     { color: #ff7b72; }
.a-green   { color: #56d364; }
.a-yellow  { color: #e3b341; }
.a-blue    { color: #79c0ff; }
.a-magenta { color: #d2a8ff; }
.a-cyan    { color: #76e3ea; }
.a-white   { color: #f0f3f6; }
.a-gray    { color: #8b949e; }

/* dashboard last-build status dots */
.repo-status { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-right: 14px; background: transparent; }
.repo-status.dot { background: var(--s-pending); }
.dot-success { background: var(--s-success) !important; }
.dot-failure, .dot-error { background: var(--s-failure) !important; }
.dot-running { background: var(--s-running) !important; animation: pulse 1.2s ease-in-out infinite; }
.dot-pending, .dot-blocked { background: var(--s-running) !important; }
.dot-killed, .dot-skipped { background: var(--s-killed) !important; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- login ---- */
.login-wall { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 48px 56px; text-align: center; width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}
.login-logo { width: 64px; height: 64px; }
.login-title { font-size: 24px; font-weight: 500; margin: 14px 0 4px; }
.login-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 28px; }
.login-error {
  background: rgba(232,69,60,.10); color: #ff7b72; border: 1px solid rgba(232,69,60,.35);
  border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 20px;
}
.btn-github {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border-radius: 6px; font-size: 14px; font-weight: 500;
  background: var(--accent); color: #fff; transition: filter .12s;
}
.btn-github:hover { filter: brightness(1.1); }

/* ---- error page ---- */
.error-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 40px; text-align: center; margin-top: 40px; }
.error-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--s-failure); color: #fff; font-size: 26px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.error-msg { background: rgba(232,69,60,.10); color: #ff7b72; border: 1px solid rgba(232,69,60,.35); padding: 12px; border-radius: 6px; text-align: left; white-space: pre-wrap; overflow: auto; font-size: 12.5px; margin: 16px 0 24px; }

@media (max-width: 820px) {
  .build-grid { grid-template-columns: 1fr; }
  .repo-desc { max-width: 220px; }
}
