/* GitLab (Pajamas) 风格主题 */
:root {
  --bg: #fbfbfd;
  --card: #ffffff;
  --border: #d9dbe1;
  --border-light: #e9e9ea;
  --text: #1f1f24;
  --text-muted: #6b6f76;
  --text-weak: #8c9198;
  --blue: #1f75cb;
  --blue-hover: #1b69b4;
  --blue-ring: rgba(31, 117, 203, 0.2);
  --green: #1a7f26;
  --green-bg: #e4f2e4;
  --red: #b32f24;
  --red-bg: #f8ddd9;
  --amber: #ad4100;
  --amber-bg: #fbe8d9;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(31, 31, 36, 0.06);
  --font: "GitLab Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  font-size: 14px;
}

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

/* ---- 顶栏（GitLab 式） ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border-light);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 48px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--blue); }
.brand-logo { color: var(--blue); flex-shrink: 0; }

.nav { display: flex; align-items: stretch; height: 100%; gap: 4px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--blue); text-decoration: none; }
.nav-link.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch { display: flex; gap: 4px; }

.lang-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  transition: all 0.12s;
}
.lang-btn:hover { border-color: var(--blue); color: var(--blue); }
.lang-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

html[data-lang="zh"] .t-en { display: none; }
html[data-lang="en"] .t-zh { display: none; }

/* ---- 布局 ---- */

.container { max-width: 1100px; margin: 0 auto; padding: 20px 20px 40px; }

.muted { color: var(--text-muted); }

/* ---- 按钮 ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}
.btn:hover { background: var(--blue-hover); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { color: var(--blue); border-color: var(--blue); background: var(--card); }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* ---- 徽章 / 状态 / 标签 ---- */

.state-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.state-open { color: var(--green); background: var(--green-bg); }
.state-closed { color: var(--red); background: var(--red-bg); }

.badge-pending {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: 100px;
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-bg);
  white-space: nowrap;
}

.badge-manual {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  height: 20px;
  border-radius: 100px;
  font-size: 12px;
  color: var(--blue);
  background: #e3effa;
  white-space: nowrap;
}

.label-pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 100px;
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}

.state-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(31, 31, 36, 0.15);
}
.state-icon-open { background: var(--green); }
.state-icon-closed { background: var(--red); }

/* ---- 列表页（GitLab 工单列表） ---- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}
.controls input,
.controls select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.controls input:focus,
.controls select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-ring);
}
.controls input { flex: 1 1 260px; min-width: 200px; }

.summary { color: var(--text-weak); font-size: 13px; margin: 0 2px 12px; }

.issue-list { display: block; }

.issue-row {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-shadow: var(--shadow);
  color: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.issue-row:hover {
  border-color: var(--blue);
  box-shadow: 0 2px 6px rgba(31, 117, 203, 0.12);
  text-decoration: none;
}
.issue-row-body { flex: 1; min-width: 0; }

.issue-row-title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.issue-row:hover .issue-row-title { color: var(--blue); }

.issue-iid {
  color: var(--text-weak);
  font-weight: 400;
  margin-right: 6px;
}

.issue-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-weak);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}
.pager button:disabled { opacity: 0.4; cursor: default; }
#pageinfo { color: var(--text-weak); font-size: 13px; }

/* ---- 详情页 ---- */

.breadcrumbs {
  font-size: 13px;
  color: var(--text-weak);
  margin-bottom: 14px;
}
.breadcrumbs a { color: var(--text-weak); }
.breadcrumbs a:hover { color: var(--blue); }
.breadcrumbs .current { color: var(--text-muted); }

.issue-head { margin-bottom: 20px; }

.issue-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.issue-title-row h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}
.issue-title-row .issue-iid { margin: 0; font-size: 15px; }

.issue-subline {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-weak);
}
.issue-subline b { color: var(--text-muted); font-weight: 600; }

.issue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 920px) {
  .issue-layout { grid-template-columns: 1fr; }
}

.issue-main { min-width: 0; }

.gl-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.gl-card-head {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.desc { white-space: normal; word-break: break-word; margin: 0; }
.desc h1, .desc h2, .desc h3, .desc h4 {
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
  margin: 16px 0 6px;
}
.desc h1:first-child, .desc h2:first-child, .desc h3:first-child { margin-top: 0; }
.desc p { margin: 6px 0; }
.desc ul, .desc ol { margin: 6px 0; padding-left: 22px; }
.desc li { margin: 2px 0; }
.desc blockquote {
  margin: 8px 0;
  padding: 2px 12px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.desc pre {
  background: #f4f4f5;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow-x: auto;
  font-size: 13px;
}
.desc code {
  background: #f4f4f5;
  border-radius: var(--radius);
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: var(--mono);
}
.desc pre code { background: none; padding: 0; }
.desc hr { border: none; border-top: 1px solid var(--border-light); margin: 14px 0; }
.desc img { max-width: 100%; border: 1px solid var(--border-light); border-radius: var(--radius); }
.comment-body-card img { max-width: 100%; border: 1px solid var(--border-light); border-radius: var(--radius); margin: 6px 0; }
.desc table { border-collapse: collapse; margin: 8px 0; }
.desc th, .desc td { border: 1px solid var(--border-light); padding: 4px 10px; font-size: 13.5px; }
.desc th { background: #fafafa; }

/* ---- 修正翻译弹窗 ---- */

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

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(31, 31, 36, 0.45);
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(31, 31, 36, 0.25);
  padding: 18px 20px;
}
.modal-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.modal-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 10px 0 4px;
}
.modal-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  background: var(--card);
  box-sizing: border-box;
}
.modal-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-ring); }
textarea.modal-input { resize: vertical; min-height: 80px; }
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.modal-spacer { flex: 1; }
.modal-msg { margin-top: 8px; font-size: 13px; }

/* ---- 历史 ---- */

.history-list { display: flex; flex-direction: column; }
.history-item {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  font-size: 13.5px;
  border-top: 1px solid var(--border-light);
  align-items: baseline;
}
.history-item:first-child { border-top: none; }
.history-date {
  color: var(--text-weak);
  font-family: var(--mono);
  font-size: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}
.history-text { color: var(--text-muted); word-break: break-word; }
.history-text b { color: var(--text); font-weight: 600; }

/* ---- 评论（时间线） ---- */

.comment { display: flex; gap: 12px; margin: 16px 0; }
.comment:first-of-type { margin-top: 0; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  user-select: none;
}

.comment-main { flex: 1; min-width: 0; }
.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--text-weak);
}
.comment-author { font-weight: 600; color: var(--text); }
.comment-body-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 6px;
  font-size: 14px;
}
.comment-body-card p { margin: 4px 0; }
.comment-body-card pre {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 10px;
  overflow-x: auto;
  font-size: 13px;
}
.comment-body-card code {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: var(--mono);
}
.comment-body-card pre code { background: none; padding: 0; }
.comment-body-card blockquote {
  margin: 6px 0;
  padding: 0 12px;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}
.comment-body-card img { max-width: 100%; border-radius: var(--radius); }

/* ---- 侧栏 ---- */

.sidebar-card { padding: 14px 16px; }
.sidebar-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.sidebar-card dl { margin: 0; }
.sidebar-card dt {
  float: left;
  clear: left;
  width: 96px;
  color: var(--text-weak);
  font-size: 13px;
  padding: 3px 0;
}
.sidebar-card dd {
  margin: 0 0 0 100px;
  padding: 3px 0;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.sidebar-card .links { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }

/* ---- 统计页 ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--blue); line-height: 1.2; }
.stat-label { color: var(--text-weak); font-size: 12.5px; margin-top: 4px; }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; font-size: 13px; }
.bar-label {
  width: 200px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}
.bar-track { flex: 1; height: 12px; background: #f4f4f5; border-radius: 6px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #6fa7e0);
  border-radius: 6px;
}
.bar-num {
  width: 56px;
  text-align: right;
  font-family: var(--mono);
  color: var(--text-muted);
}

/* ---- 页脚 ---- */

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px 30px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-light);
  color: var(--text-weak);
  font-size: 12.5px;
}
.site-footer a { color: var(--text-weak); }
.site-footer a:hover { color: var(--blue); }
