:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --panel: #fff;
  --border: #dedee3;
  --muted: #686873;
  --text: #202124;
  --blue: #315efb;
  --green: #1f883d;
  --purple: #7656b5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
main { max-width: 1080px; margin: 0 auto; padding: 48px 24px 60px; }

.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.page-title h1 { margin: 0; font-size: 34px; line-height: 1.15; letter-spacing: -.025em; }
.page-title p { margin: 0; color: var(--muted); }
.page-title .page-subtitle { margin-top: 6px; font-size: 16px; }
.page-subtitle a { color: var(--blue); }

.controls { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 8px; margin-bottom: 16px; }
.search { display: flex; align-items: center; gap: 7px; padding: 5px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px #0969da26; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: inherit; }
.controls select, .header-actions button { border: 1px solid var(--border); background: var(--panel); color: inherit; border-radius: 6px; padding: 6px 10px; }

.issue-shell { overflow: hidden; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 1px 2px #0000000a; }
.list-header { min-height: 52px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; background: #fafafa; border-bottom: 1px solid var(--border); }
.summary-filter, .header-actions button { cursor: pointer; }
.summary-filter { border: 0; background: none; color: inherit; padding: 4px 0; }
.header-actions { display: flex; gap: 6px; }
.header-actions button { padding: 4px 9px; font-size: 12px; }

.issue { border-bottom: 1px solid var(--border); }
.issue:last-child { border-bottom: 0; }
.issue-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 12px 16px; border: 0; background: transparent; color: inherit; text-align: left; }
.issue-row:hover { background: #f6f8fa; }
.issue-toggle { display: block; max-width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.issue-title { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.issue-title:hover { color: var(--blue); }
.meta { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.issue-permalink { color: inherit; text-decoration: none; }
.issue-permalink:hover { color: var(--blue); text-decoration: underline; }
.count { display: flex; align-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }

.conversation { padding: 0 16px 18px; background: #fff; }
.conversation[hidden] { display: none; }
.message { position: relative; border: 1px solid var(--border); border-radius: 6px; margin-top: 10px; overflow: hidden; }
.message-head { padding: 8px 12px; background: #f6f8fa; border-bottom: 1px solid var(--border); color: var(--muted); }
.message-head strong { color: var(--text); }
.message-body { margin: 0; padding: 14px 16px; overflow-wrap: anywhere; color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.message-body p, .message-body div, .message-body span, .message-body li, .message-body blockquote { font-family: inherit; font-size: inherit; line-height: inherit; }
.message-body > :first-child { margin-top: 0; }
.message-body > :last-child { margin-bottom: 0; }
.message-body p { margin: 0 0 12px; }
.message-body ul, .message-body ol { padding-left: 26px; }
.message-body blockquote { margin: 12px 0; padding: 1px 14px; color: var(--muted); border-left: 3px solid var(--border); }
.message-body pre { max-width: 100%; overflow: auto; padding: 12px; background: #f4f4f6; border: 1px solid var(--border); border-radius: 5px; white-space: pre; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.message-body code { padding: .1em .3em; background: #f0f0f2; border-radius: 3px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.message-body pre code { padding: 0; background: transparent; }
.message-body table { display: block; max-width: 100%; overflow: auto; border-collapse: collapse; }
.message-body th, .message-body td { padding: 6px 9px; border: 1px solid var(--border); }
.message-body a { color: var(--blue); }
.message-body .empty-message { color: var(--muted); font-style: italic; }
.issue-attachment { display: block; margin: 10px 0 14px; }
.issue-attachment img { display: block; max-width: min(100%, 900px); max-height: 720px; width: auto; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; object-fit: contain; }
#empty { padding: 60px 20px; text-align: center; color: var(--muted); }

@media (max-width: 800px) {
  main { padding: 28px 12px 40px; }
  .page-title { align-items: flex-start; flex-direction: column; gap: 8px; }
  .controls { grid-template-columns: 1fr; }
  .search { grid-column: 1 / -1; }
  .issue-row { grid-template-columns: minmax(0, 1fr); }
  .count { display: none; }
  .conversation { padding-left: 16px; }
  .list-header { align-items: flex-start; gap: 8px; }
  .header-actions { flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #121316; --panel: #191a1f; --border: #34353d; --muted: #a0a0aa; --text: #f1f1f3; --blue: #7895ff; --green: #52b86d; --purple: #ad8ee6; }
  .list-header, .issue-row:hover, .message-head { background: #222329; }
  .conversation { background: #191a1f; }
  .message-body pre, .message-body code { background: #24252b; }
}
