:root {
  --bg: #ffffff;
  --bg-inset: #f6f8fa;
  --bg-overlay: #ffffff;
  --border: #d0d7de;
  --border-muted: #d8dee4;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --accent: #0969da;
  --accent-bg: #ddf4ff;
  --open: #1a7f37;
  --open-bg: #1f883d;
  --closed: #8250df;
  --danger: #cf222e;
  --danger-bg: #ffebe9;
  --btn-bg: #f6f8fa;
  --btn-hover: #eef1f4;
  --shadow: 0 8px 24px rgba(140,149,159,0.2);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-inset: #161b22;
    --bg-overlay: #161b22;
    --border: #30363d;
    --border-muted: #21262d;
    --fg: #e6edf3;
    --fg-muted: #8d96a0;
    --accent: #4493f8;
    --accent-bg: #121d2f;
    --open: #3fb950;
    --open-bg: #238636;
    --closed: #ab7df8;
    --danger: #f85149;
    --danger-bg: #25171c;
    --btn-bg: #21262d;
    --btn-hover: #30363d;
    --shadow: 0 8px 24px rgba(1,4,9,0.8);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1216px; margin: 0 auto; padding: 0 24px; }
.octicon { vertical-align: text-bottom; fill: currentColor; }
.inline { display: inline; }
.muted { color: var(--fg-muted); }
.tt { cursor: default; }

/* ---- Header ---- */
.site-header { background: var(--bg-inset); border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.header-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.repo-name { display: flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 600; font-size: 16px; }
.repo-name:hover { text-decoration: none; }
.header-nav { display: flex; gap: 8px; flex: 1; }
.header-nav a { color: var(--fg); padding: 5px 10px; border-radius: 6px; display: flex; align-items: center; gap: 6px; }
.header-nav a:hover { background: var(--btn-hover); text-decoration: none; }
.header-nav a.active { font-weight: 600; background: var(--btn-hover); }
.counter { background: rgba(140,149,159,0.25); border-radius: 2em; padding: 0 6px; font-size: 12px; font-weight: 500; }
.header-user { display: flex; align-items: center; gap: 8px; }
.header-username { font-weight: 600; }
.header-signout { color: var(--fg-muted); font-size: 12px; }
.avatar { border-radius: 50%; vertical-align: middle; background: #f0f0f0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 16px; font-size: 14px; font-weight: 500; line-height: 20px;
  color: var(--fg); background: var(--btn-bg);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  font-family: inherit;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn-sm { padding: 3px 12px; font-size: 12px; }
.btn-primary { color: #fff; background: var(--open-bg); border-color: rgba(31,35,40,0.15); }
.btn-primary:hover { background: #1a7f37; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-invisible { border: none; background: none; color: var(--accent); }
.btn-invisible:hover { background: var(--btn-hover); }
.btn[disabled] { opacity: 0.6; cursor: default; }

/* ---- Forms ---- */
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=text], input[type=date], textarea, select {
  font-family: inherit; font-size: 14px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px 12px; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(9,105,218,0.3); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; }

/* ---- Search + filter bar ---- */
.subhead { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.search-form { flex: 1; display: flex; min-width: 280px; }
.search-wrap { position: relative; flex: 1; }
.search-wrap .octicon { position: absolute; left: 10px; top: 8px; color: var(--fg-muted); }
.search-wrap input { padding-left: 32px; background: var(--bg-inset); }
.search-wrap input:focus { background: var(--bg); }

/* ---- Issue list ---- */
.box { border: 1px solid var(--border); border-radius: 6px; }
.box-header {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-inset); padding: 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px 6px 0 0;
}
.state-toggle { display: flex; gap: 16px; }
.state-toggle a, .state-toggle span { color: var(--fg-muted); display: flex; align-items: center; gap: 4px; font-weight: 400; }
.state-toggle .current { color: var(--fg); font-weight: 600; }
.state-toggle a:hover { color: var(--fg); text-decoration: none; }
.filters { display: flex; gap: 4px; margin-left: auto; }

.dropdown { position: relative; }
.dropdown > summary {
  list-style: none; cursor: pointer; color: var(--fg-muted);
  padding: 4px 8px; border-radius: 6px; display: flex; align-items: center; gap: 4px;
  user-select: none;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { color: var(--fg); }
.dropdown-menu {
  position: absolute; right: 0; top: 100%; z-index: 99;
  min-width: 220px; max-height: 400px; overflow-y: auto;
  background: var(--bg-overlay); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: var(--shadow);
  margin-top: 4px;
}
.dropdown-menu .menu-title { padding: 8px 10px; font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); }
.dropdown-menu a, .dropdown-menu button.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 10px; color: var(--fg); font-size: 12px; text-align: left;
  border: none; background: none; cursor: pointer; font-family: inherit;
  border-bottom: 1px solid var(--border-muted);
}
.dropdown-menu a:last-child, .dropdown-menu button.menu-item:last-child { border-bottom: none; }
.dropdown-menu a:hover, .dropdown-menu button.menu-item:hover { background: var(--bg-inset); text-decoration: none; }
.dropdown-menu .check { width: 16px; visibility: hidden; flex-shrink: 0; }
.dropdown-menu .selected .check { visibility: visible; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

.issue-row {
  display: flex; gap: 8px; padding: 8px 16px;
  border-bottom: 1px solid var(--border-muted);
}
.issue-row:last-child { border-bottom: none; border-radius: 0 0 6px 6px; }
.issue-row:hover { background: var(--bg-inset); }
.issue-row .state-icon { padding-top: 2px; }
.state-icon.open { color: var(--open); }
.state-icon.closed { color: var(--closed); }
.state-icon.not-planned { color: var(--fg-muted); }
.issue-main { flex: 1; min-width: 0; }
.issue-title-line { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.issue-title-link { color: var(--fg); font-weight: 600; font-size: 16px; }
.issue-title-link:hover { color: var(--accent); text-decoration: none; }
.issue-meta { color: var(--fg-muted); font-size: 12px; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.issue-meta a { color: var(--fg-muted); }
.issue-meta a:hover { color: var(--accent); text-decoration: none; }
.issue-side { display: flex; align-items: flex-start; gap: 16px; padding-top: 4px; }
.issue-side .comment-link { color: var(--fg-muted); display: flex; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; }
.issue-side .comment-link:hover { color: var(--accent); text-decoration: none; }
.assignee-stack { display: flex; }
.assignee-stack img { margin-left: -6px; border: 1px solid var(--bg); }
.assignee-stack img:first-child { margin-left: 0; }

.label-chip {
  display: inline-block; padding: 0 8px; font-size: 12px; font-weight: 500;
  line-height: 20px; border-radius: 2em; white-space: nowrap;
}
.label-link:hover { text-decoration: none; }

.blankslate { text-align: center; padding: 64px 32px; }
.blankslate .octicon { color: var(--fg-muted); margin-bottom: 8px; }
.blankslate h3 { margin: 8px 0; }
.blankslate p { color: var(--fg-muted); max-width: 500px; margin: 8px auto; }

.pagination { display: flex; justify-content: center; gap: 4px; margin: 20px 0; }
.pagination a, .pagination .current, .pagination .disabled {
  padding: 5px 10px; border-radius: 6px; color: var(--fg);
}
.pagination a:hover { border: 1px solid var(--border); text-decoration: none; padding: 4px 9px; }
.pagination .current { background: var(--accent); color: #fff; }
.pagination .disabled { color: var(--fg-muted); }

.pinned-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pinned-card { border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; }
.pinned-card .pin-tag { color: var(--fg-muted); font-size: 12px; display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }

/* ---- Issue page ---- */
.gh-header { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.gh-title-row { display: flex; gap: 12px; align-items: flex-start; }
.gh-title { flex: 1; margin: 0 0 8px; font-size: 26px; font-weight: 400; line-height: 1.25; word-break: break-word; }
.gh-title .issue-number { color: var(--fg-muted); font-weight: 300; }
.gh-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--fg-muted); }
.state-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 2em; color: #fff; font-weight: 500;
}
.state-badge.open { background: var(--open-bg); }
.state-badge.closed { background: var(--closed); }
.state-badge.not-planned { background: #59636e; }

.issue-layout { display: flex; gap: 24px; align-items: flex-start; }
.timeline { flex: 1; min-width: 0; }
.sidebar { width: 256px; flex-shrink: 0; }
@media (max-width: 900px) { .issue-layout { flex-direction: column; } .sidebar { width: 100%; } }

.comment-box { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 16px; position: relative; }
.comment-box.by-author { border-color: var(--border); }
.comment-header {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-inset); padding: 8px 16px;
  border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0;
  color: var(--fg-muted); font-size: 13px;
}
.comment-header .author { font-weight: 600; color: var(--fg); }
.comment-header .author-badge {
  margin-left: auto; font-size: 12px; border: 1px solid var(--border);
  border-radius: 2em; padding: 0 8px; color: var(--fg-muted);
}
.comment-header .edit-menu { margin-left: 4px; }
.comment-header .author-badge + .edit-menu, .comment-header .edit-menu:first-of-type { margin-left: auto; }
.comment-header .author-badge ~ .edit-menu { margin-left: 4px; }
.comment-body { padding: 16px; overflow-wrap: break-word; }
.comment-body > :first-child { margin-top: 0; }
.comment-body > :last-child { margin-bottom: 0; }
.comment-footer { padding: 0 16px 12px; }

.timeline-item {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0 12px 4px; margin-left: 16px;
  color: var(--fg-muted); font-size: 13px;
  position: relative;
}
.timeline-item::before {
  content: ""; position: absolute; left: 11px; top: 0; bottom: 0;
  width: 2px; background: var(--border-muted); z-index: -1;
}
.timeline-item .event-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-inset); border: 2px solid var(--bg); color: var(--fg-muted);
}
.timeline-item .event-icon.closed-icon { background: var(--closed); color: #fff; }
.timeline-item .event-icon.open-icon { background: var(--open-bg); color: #fff; }
.timeline-item .event-icon.np-icon { background: #59636e; color: #fff; }
.timeline-item b { color: var(--fg); font-weight: 600; }

/* markdown */
.comment-body h1, .comment-body h2 { border-bottom: 1px solid var(--border-muted); padding-bottom: 0.3em; }
.comment-body h1, .comment-body h2, .comment-body h3, .comment-body h4 { margin: 24px 0 16px; line-height: 1.25; }
.comment-body p { margin: 0 0 16px; }
.comment-body code { background: rgba(140,149,159,0.2); border-radius: 6px; padding: 0.2em 0.4em; font-size: 85%; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.comment-body .highlight { background: var(--bg-inset); border-radius: 6px; margin-bottom: 16px; overflow-x: auto; }
.comment-body .highlight pre { margin: 0; padding: 16px; }
.comment-body .highlight code { background: none; padding: 0; font-size: 85%; }
.comment-body blockquote { border-left: 0.25em solid var(--border); color: var(--fg-muted); margin: 0 0 16px; padding: 0 1em; }
.comment-body ul, .comment-body ol { margin: 0 0 16px; padding-left: 2em; }
.comment-body li { margin: 0.25em 0; }
.comment-body li.task-item { list-style: none; margin-left: -1.4em; }
.comment-body table { border-collapse: collapse; margin-bottom: 16px; display: block; overflow-x: auto; }
.comment-body th, .comment-body td { border: 1px solid var(--border); padding: 6px 13px; }
.comment-body th { font-weight: 600; }
.comment-body tr:nth-child(2n) { background: var(--bg-inset); }
.comment-body img.md-img { max-width: 100%; }
.comment-body hr { border: none; border-top: 4px solid var(--border-muted); border-radius: 2px; margin: 24px 0; }
.user-mention { font-weight: 600; color: var(--fg); }

/* reactions */
.reaction-bar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.reaction-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); border-radius: 2em;
  background: none; padding: 1px 8px; font-size: 12px; cursor: pointer;
  color: var(--fg-muted); font-family: inherit; line-height: 18px;
}
.reaction-btn:hover { background: var(--bg-inset); }
.reaction-btn.selected { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.reaction-btn.static { cursor: default; }
.picker-btn { border-radius: 50%; width: 26px; height: 26px; padding: 0; justify-content: center; }
.reaction-menu { display: flex; min-width: 0; padding: 4px; left: 0; right: auto; }
.reaction-choice { border: none; background: none; font-size: 16px; padding: 4px 6px; cursor: pointer; border-radius: 6px; }
.reaction-choice:hover { background: var(--bg-inset); }
.reaction-choice.selected { background: var(--accent-bg); }

/* new comment form */
.new-comment { display: flex; gap: 12px; margin-top: 8px; }
.new-comment .avatar-col { flex-shrink: 0; }
.new-comment-form { flex: 1; }
.tabnav { display: flex; gap: 4px; background: var(--bg-inset); border-bottom: 1px solid var(--border); padding: 8px 8px 0; border-radius: 6px 6px 0 0; }
.tabnav button {
  border: 1px solid transparent; border-bottom: none; background: none;
  padding: 6px 14px; cursor: pointer; font-family: inherit; font-size: 13px;
  border-radius: 6px 6px 0 0; color: var(--fg-muted);
}
.tabnav button.active { background: var(--bg); border-color: var(--border); color: var(--fg); font-weight: 500; }
.comment-edit-area { border: none; border-radius: 0 0 6px 6px; min-height: 120px; }
.comment-edit-area:focus { box-shadow: none; }
.md-preview { padding: 16px; min-height: 120px; border-bottom: 1px dashed var(--border); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 8px 8px; flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }

/* split close button */
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group details > summary { border-radius: 0 6px 6px 0; border-left: none; padding-left: 8px; padding-right: 8px; }
.btn-group .dropdown-menu { min-width: 260px; }

/* ---- Sidebar ---- */
.sidebar-section { border-bottom: 1px solid var(--border-muted); padding: 16px 0; font-size: 12px; }
.sidebar-section:first-child { padding-top: 0; }
.sidebar-title { display: flex; justify-content: space-between; align-items: center; color: var(--fg-muted); font-weight: 600; margin-bottom: 8px; }
.sidebar-title .gear-btn { color: var(--fg-muted); cursor: pointer; background: none; border: none; padding: 2px; }
.sidebar-title .gear-btn:hover { color: var(--accent); }
.sidebar-section .item-list { display: flex; flex-direction: column; gap: 6px; }
.sidebar-section .item-list a { color: var(--fg); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sidebar-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--border-muted); overflow: hidden; margin: 4px 0; }
.progress-bar > span { display: block; height: 100%; background: var(--open-bg); }
.participant-row { display: flex; flex-wrap: wrap; gap: 4px; }
.sidebar-action { background: none; border: none; color: var(--fg-muted); font-weight: 600; font-size: 12px; cursor: pointer; padding: 0; font-family: inherit; display: flex; gap: 6px; align-items: center; }
.sidebar-action:hover { color: var(--accent); }
.danger-text { color: var(--danger) !important; }

/* ---- Labels page ---- */
.label-row { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border-muted); }
.label-row:last-child { border-bottom: none; }
.label-row .label-col { width: 25%; }
.label-row .desc-col { flex: 1; color: var(--fg-muted); }
.label-row .count-col { width: 15%; }
.label-row .count-col a { color: var(--fg-muted); }
.label-row .actions-col { display: flex; gap: 12px; }
.label-row .actions-col button, .label-row .actions-col a { background: none; border: none; color: var(--fg-muted); font-size: 12px; cursor: pointer; padding: 0; font-family: inherit; }
.label-row .actions-col button:hover, .label-row .actions-col a:hover { color: var(--accent); text-decoration: none; }
.label-editor { padding: 16px; background: var(--bg-inset); border-bottom: 1px solid var(--border-muted); }
.label-editor-fields { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.label-editor-fields .f { flex: 1; min-width: 140px; }
.label-editor-fields label { font-weight: 600; display: block; margin-bottom: 4px; font-size: 12px; }
.color-input-wrap { display: flex; gap: 4px; }
.color-swatch-btn { width: 32px; flex-shrink: 0; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }

/* ---- Milestones ---- */
.milestone-row { padding: 16px; border-bottom: 1px solid var(--border-muted); display: flex; gap: 24px; }
.milestone-row:last-child { border-bottom: none; }
.milestone-info { flex: 1; }
.milestone-info h3 { margin: 0 0 4px; font-size: 18px; }
.milestone-info h3 a { color: var(--fg); }
.milestone-meta { color: var(--fg-muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.milestone-progress { width: 40%; }
.milestone-stats { display: flex; gap: 12px; font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.milestone-stats b { color: var(--fg); }
.milestone-actions { display: flex; gap: 8px; font-size: 12px; margin-top: 6px; }
.milestone-actions a, .milestone-actions button { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font-family: inherit; font-size: 12px; }
.milestone-actions .danger { color: var(--danger); }

/* login */
.login-box { max-width: 340px; margin: 60px auto; }
.login-box .box { padding: 24px; }
.login-box h1 { text-align: center; font-size: 24px; font-weight: 300; }

/* product picker + chips */
.product-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.product-option {
  flex: 1; min-width: 200px; display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 6px; padding: 12px; cursor: pointer;
}
.product-option:hover { background: var(--bg-inset); }
.product-option:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.product-chip {
  display: inline-block; padding: 0 10px; font-size: 12px; font-weight: 600;
  line-height: 22px; border-radius: 2em; white-space: nowrap;
  border: 1px solid var(--border); color: var(--fg-muted);
}
.product-chip:hover { text-decoration: none; color: var(--accent); border-color: var(--accent); }
.product-happypets { border-color: rgba(26,127,55,0.5); color: var(--open); }
.product-petcreator { border-color: rgba(130,80,223,0.5); color: var(--closed); }

/* attachments */
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.attachment-item {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
  font-size: 12px; color: var(--fg);
}
.attachment-item:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

/* discord + github buttons */
.discord-btn { background: #5865F2; color: #fff; border-color: rgba(31,35,40,0.15); }
.discord-btn:hover { background: #4752C4; color: #fff; }
.github-btn { background: #24292f; color: #fff; border-color: rgba(31,35,40,0.15); }
.github-btn:hover { background: #32383f; color: #fff; }

/* flash */
.flash { border: 1px solid var(--accent); background: var(--accent-bg); color: var(--fg); border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; }
.flash.error { border-color: var(--danger); background: var(--danger-bg); }

.page-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title-row h1 { font-size: 24px; font-weight: 400; margin: 0; flex: 1; }
