/* Triage — neutral, minimal. Instance accent is set at runtime as --accent. */
:root {
  --accent: #5865f2;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-hover: #f0f2f5;
  --line: #e3e6ea;
  --text: #1c1f23;
  --muted: #5d6570;
  --dim: #8a929c;
  --code-bg: #f1f3f5;
  --radius: 8px;
  --s-open: #1f883d;
  --s-confirmed: #9a6700;
  --s-in_progress: #0969da;
  --s-needs_retest: #8250df;
  --s-fixed: #6639ba;
  --s-rejected: #cf222e;
  --s-duplicate: #6e7781;
  --s-closed: #6e7781;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --bg-soft: #161b22;
    --bg-hover: #1c222b;
    --line: #2a313c;
    --text: #e6edf3;
    --muted: #9da7b3;
    --dim: #6e7781;
    --code-bg: #1c222b;
    --s-open: #3fb950;
    --s-confirmed: #d29922;
    --s-in_progress: #4493f8;
    --s-needs_retest: #ab7df8;
    --s-fixed: #a371f7;
    --s-rejected: #f85149;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.hidden { display: none !important; }

/* Top bar */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 15px; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-nav { display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--muted); font-weight: 500; }
.nav-link:hover { color: var(--text); text-decoration: none; }
.user-box { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.user-box button { background: none; border: 0; color: var(--dim); cursor: pointer; padding: 4px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; background: var(--bg-soft); display: inline-grid; place-items: center; color: var(--dim); font-size: 11px; font-weight: 600; }

/* Buttons & fields */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; min-height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--text); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ok { color: var(--s-open); }
.btn-bad { color: var(--s-rejected); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { min-height: 26px; padding: 2px 8px; font-size: 13px; }
.field, .select, .textarea { width: 100%; padding: 6px 10px; min-height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); outline: none; }
.field:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.textarea.tall { min-height: 260px; }
.label { display: block; font-weight: 600; margin: 16px 0 6px; }
.hint { color: var(--dim); font-size: 12px; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }

/* Page head */
.page-head { margin-bottom: 16px; }
.h1 { font-size: 24px; font-weight: 600; margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }

/* List */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 260px; }
.toolbar .select { width: auto; flex: 0 1 auto; }
.box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--bg-soft); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: flex; gap: 16px; }
.tab { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.tab.on { color: var(--text); font-weight: 600; }
.tab .n { color: var(--dim); font-weight: 400; }
.row { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--bg-soft); }
.row-icon { color: var(--st); padding-top: 2px; }
.row-title { color: var(--text); font-weight: 600; font-size: 15px; margin-right: 4px; }
.row-meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.row-side { display: flex; gap: 12px; color: var(--dim); font-size: 12px; white-space: nowrap; }
.row-side span { display: inline-flex; gap: 4px; align-items: center; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); }

/* Labels / status */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); color: var(--muted); line-height: 20px; margin-right: 4px; white-space: nowrap; vertical-align: 1px; }
.chip.staff { color: var(--s-rejected); border-color: color-mix(in srgb, var(--s-rejected) 45%, transparent); }
.chip.prio-critical { color: #fff; background: var(--s-rejected); border-color: var(--s-rejected); }
.chip.prio-high { color: var(--s-confirmed); border-color: var(--s-confirmed); }
.chip.st { color: var(--st); border-color: color-mix(in srgb, var(--st) 50%, transparent); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; color: #fff; font-weight: 500; background: var(--st); white-space: nowrap; }
.st-open { --st: var(--s-open); } .st-confirmed { --st: var(--s-confirmed); } .st-in_progress { --st: var(--s-in_progress); }
.st-needs_retest { --st: var(--s-needs_retest); } .st-fixed { --st: var(--s-fixed); } .st-rejected { --st: var(--s-rejected); }
.st-duplicate { --st: var(--s-duplicate); } .st-closed { --st: var(--s-closed); }

/* Issue page */
.issue-title { font-size: 26px; font-weight: 400; margin: 0 0 8px; overflow-wrap: anywhere; }
.issue-title .num { color: var(--dim); }
.issue-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); padding-bottom: 16px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.issue-sub .push { margin-left: auto; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 28px; }
.comment { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.comment-head { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--line); color: var(--muted); border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.comment-head strong { color: var(--text); }
.comment-head .push { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.comment.team .comment-head { background: color-mix(in srgb, var(--accent) 8%, var(--bg-soft)); }
.comment.internal { border-color: color-mix(in srgb, var(--s-rejected) 45%, var(--line)); }
.comment.internal .comment-head { background: color-mix(in srgb, var(--s-rejected) 7%, var(--bg-soft)); }
.comment-body { padding: 12px; overflow-wrap: anywhere; }
.role { font-size: 11px; padding: 0 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); line-height: 18px; }
.event { display: flex; align-items: center; gap: 8px; color: var(--muted); padding: 0 0 16px 16px; margin-left: 12px; border-left: 2px solid var(--line); }
.event-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-soft); border: 1px solid var(--line); display: grid; place-items: center; margin-left: -29px; flex: none; color: var(--muted); }
.event-dot svg.i { width: 13px; height: 13px; }
.event strong { color: var(--text); }
.event .status { padding: 0 8px; font-size: 12px; }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote { margin: 0 0 10px; }
.md h3, .md h4 { margin: 14px 0 6px; font-size: 15px; }
.md ul, .md ol { padding-left: 22px; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--code-bg); border-radius: 6px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--line); padding: 0 12px; color: var(--muted); }
.md img { max-width: 100%; border-radius: 6px; border: 1px solid var(--line); display: block; margin: 6px 0; }
.md .muted { color: var(--dim); font-style: italic; }

/* Sidebar */
.side-sec { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.side-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.side-row { display: flex; gap: 6px; }
.ticket { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.ticket .off { color: var(--dim); text-decoration: line-through; }
.ticket button { margin-left: auto; }
.mono { font-family: var(--mono); font-size: 11px; color: var(--dim); overflow-wrap: anywhere; }

/* Retest */
.retest { border: 1px solid var(--s-needs_retest); background: color-mix(in srgb, var(--s-needs_retest) 8%, var(--bg)); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.retest > div { flex: 1 1 240px; }

/* Composer */
.composer { border: 1px solid var(--line); border-radius: var(--radius); }
.composer .textarea { border: 0; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--bg-soft); flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.composer-foot .grow { flex: 1; }
.composer-foot .select { width: auto; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 8px; }
.attach-list:empty { display: none; }
.attach { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; color: var(--muted); }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 16px; }
.gallery img { width: 120px; height: 80px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* Transcript */
.transcript { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; max-height: 480px; overflow-y: auto; }
.tmsg { padding: 6px 12px; border-bottom: 1px solid var(--line); }
.tmsg:last-child { border-bottom: 0; }
.tmsg .who { font-weight: 600; margin-right: 6px; }
.tmsg .when { color: var(--dim); font-size: 12px; }
.tmsg .txt { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Forms */
.form { max-width: 820px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--bg); border: 0; padding: 5px 12px; cursor: pointer; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--bg-soft); color: var(--text); font-weight: 600; }
.notice { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--bg-soft); color: var(--muted); }
.actions { margin-top: 18px; display: flex; gap: 8px; }
.signin { max-width: 360px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.signin .btn { justify-content: center; min-height: 40px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 6px; transition: .18s; z-index: 50; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--s-rejected); color: #fff; }
.loading { padding: 60px 0; text-align: center; color: var(--dim); }
.foot { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.foot a { color: var(--dim); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #navNew span, .nav-link, .user-name { display: none; }
  .row { grid-template-columns: 16px 1fr; }
  .row-side { grid-column: 2; }
  .toolbar .select { flex: 1 1 45%; }
  .issue-title { font-size: 21px; }
}
