/* Dark dev-tool theme. One file, CSS variables, no framework. */
:root {
  --bg0: #090c10;
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1f2630;
  --bg-hover: #1c232d;
  --border: #2d333b;
  --border-soft: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --accent: #4493f8;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --orange: #f0883e;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.22);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg0);
  background-image:
    radial-gradient(900px 500px at 80% -10%, rgba(68,147,248,.10), transparent 60%),
    radial-gradient(700px 500px at -10% 0%, rgba(63,185,80,.06), transparent 55%);
  background-attachment: fixed;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* layout */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px; height: 56px;
  background: rgba(13,17,23,.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; font-size: 16px; color: var(--text); letter-spacing: -0.01em; }
.topbar .crumb { color: var(--muted); }
.topbar .spacer { flex: 1; }
.page { max-width: none; margin: 0 auto; padding: 24px 32px 64px; }
.page h1 { font-size: 22px; margin: 0 0 20px; letter-spacing: -0.02em; }
.row { display: flex; gap: 10px; align-items: center; }

/* page header (title + actions) */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: linear-gradient(180deg, var(--bg2), var(--bg));
  border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.stat.accent-red .n { color: var(--red); }
.stat.accent-amber .n { color: var(--amber); }
.stat.accent-green .n { color: var(--green); }
.stat.accent-blue .n { color: var(--accent); }

/* toolbar (filters) */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search input { width: 100%; padding-left: 34px; }
.toolbar .search::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 17px; pointer-events: none;
}

/* cards & tables */
.card { background: var(--bg2); border: 1px solid var(--border-soft); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 14px; }
.card .pad, .card.pad { padding: 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; background: var(--bg2);
     color: var(--faint); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; transition: background .1s ease; }
tbody tr.click:hover { background: var(--bg-hover); }
/* severity accent bar on the leading cell (distinct from the .sev-* badge classes on purpose) */
tr.row-crash  td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tr.row-high   td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
tr.row-normal td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
tr.row-low    td:first-child { box-shadow: inset 3px 0 0 var(--faint); }
.cell-title b { font-weight: 600; }
.empty { padding: 56px 40px; text-align: center; color: var(--muted); }
.empty .big { font-size: 15px; color: var(--text); }

/* controls */
button, .btn {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease; line-height: 1.2;
}
button:hover, .btn:hover { border-color: var(--faint); background: #262d38; }
button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
button.primary:hover { background: #2b7bff; border-color: #2b7bff; }
button.danger { background: rgba(248,81,73,.12); border-color: rgba(248,81,73,.4); color: var(--red); }
button.danger:hover { background: rgba(248,81,73,.2); border-color: var(--red); }
.danger-zone { border-color: rgba(248,81,73,.3); }
.danger-zone label { color: var(--red); }
button:disabled { opacity: 0.5; cursor: default; }
input, select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px; font-size: 14px;
}
select { cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(68,147,248,.18); }
textarea.notes { width: 100%; resize: vertical; line-height: 1.5; font-family: inherit; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 4px; }

/* badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
         white-space: nowrap; border: 1px solid transparent; }
.sev-low    { background: #262c36; color: var(--muted); }
.sev-normal { background: rgba(31,111,235,.16); color: #79b8ff; border-color: rgba(31,111,235,.3); }
.sev-high   { background: rgba(240,136,62,.15); color: var(--orange); border-color: rgba(240,136,62,.3); }
.sev-crash  { background: rgba(248,81,73,.15); color: var(--red); border-color: rgba(248,81,73,.35); }
/* one colour per workflow state, reused by the badge, the filter tab and the picker button */
.st-open             { background: rgba(210,153,34,.15); color: var(--amber); border-color: rgba(210,153,34,.3); }
.st-pending          { background: rgba(163,113,247,.16); color: #c297ff; border-color: rgba(163,113,247,.32); }
.st-waiting_for_test { background: rgba(31,111,235,.16); color: #79b8ff; border-color: rgba(31,111,235,.3); }
.st-closed           { background: rgba(63,185,80,.15); color: var(--green); border-color: rgba(63,185,80,.3); }

/* status filter tabs (issues list) */
.status-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.status-tab {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 7px 9px 7px 15px; font-size: 13px; font-weight: 600;
  background: var(--bg2); border: 1px solid var(--border-soft); color: var(--muted);
}
.status-tab:hover { background: var(--bg-hover); border-color: var(--border); color: var(--text); }
.status-tab .n {
  min-width: 20px; text-align: center; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: rgba(255,255,255,.07);
}
.status-tab.active { color: #fff; border-color: transparent; background: var(--accent); }
.status-tab.active:hover { color: #fff; border-color: transparent; }
.status-tab.active .n { background: rgba(0,0,0,.26); }
.status-tab.st-tab-open.active             { background: #b07d15; }
.status-tab.st-tab-pending.active          { background: #7c4dcc; }
.status-tab.st-tab-waiting_for_test.active { background: #1f6feb; }
.status-tab.st-tab-closed.active           { background: #2ea043; }

/* status picker (issue detail) — the state it is already in reads as pressed, not as another option */
.status-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.status-btn.active { color: #fff; border-color: transparent; font-weight: 600; }
.status-btn.st-btn-open.active             { background: #b07d15; }
.status-btn.st-btn-pending.active          { background: #7c4dcc; }
.status-btn.st-btn-waiting_for_test.active { background: #1f6feb; }
.status-btn.st-btn-closed.active           { background: #2ea043; }
.status-btn.active:hover { border-color: rgba(255,255,255,.35); }

/* game pill */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px;
        background: var(--bg3); border: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text); white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* game-grouped issues */
.game-group + .game-group { margin-top: 14px; }
.gg-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; user-select: none; }
.gg-head:hover { background: var(--bg-hover); }
.game-group.open .gg-head { border-bottom: 1px solid var(--border-soft); }
.gg-caret { color: var(--faint); font-size: 12px; width: 12px; transition: transform .15s ease; }
.game-group.open .gg-caret { transform: rotate(90deg); }
.gg-avatar { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
             font-weight: 700; color: #fff; font-size: 13px; flex: none; }
.gg-name { font-weight: 600; font-size: 15px; }
.gg-counts { margin-left: auto; display: flex; gap: 7px; align-items: center; }
.gg-count { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #262c36; color: var(--muted); }
.gg-count.open { background: rgba(210,153,34,.15); color: var(--amber); }
.gg-count.crash { background: rgba(248,81,73,.15); color: var(--red); }

/* issue grid (screenshot thumbnails) */
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 14px; padding: 16px; }
.issue-card {
  background: var(--bg); border: 1px solid var(--border-soft); border-top: 3px solid var(--border);
  border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: transform .1s ease, border-color .12s ease;
}
.issue-card:hover { transform: translateY(-3px); border-color: var(--faint); }
.issue-card.row-crash  { border-top-color: var(--red); }
.issue-card.row-high   { border-top-color: var(--orange); }
.issue-card.row-normal { border-top-color: var(--accent); }
.issue-card.row-low    { border-top-color: var(--faint); }
.issue-thumb { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: center top; background: #0a0d12; display: block; }
.issue-thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 30px; filter: grayscale(.4) opacity(.6); }
.issue-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.issue-title { font-weight: 600; font-size: 13.5px; line-height: 1.35;
               display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.issue-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.issue-foot { color: var(--muted); font-size: 11.5px; }

/* linked multiplayer sessions */
.issue-card { position: relative; }
.link-badge {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  background: rgba(13,17,23,.82); backdrop-filter: blur(4px); border: 1px solid var(--accent);
  color: #79b8ff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.card.linked { border-color: rgba(68,147,248,.4); }
.sib-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sib {
  display: flex; gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--border-soft);
  border-left: 3px solid var(--border); border-radius: 8px; cursor: pointer; transition: background .1s, border-color .12s;
}
.sib:hover { background: var(--bg-hover); border-color: var(--faint); }
.sib.row-crash  { border-left-color: var(--red); }
.sib.row-high   { border-left-color: var(--orange); }
.sib.row-normal { border-left-color: var(--accent); }
.sib.row-low    { border-left-color: var(--faint); }
.sib-thumb { width: 52px; height: 68px; object-fit: cover; object-position: center top; border-radius: 6px; background: #0a0d12; flex: none; }
.sib-thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 20px; }
.sib-body { min-width: 0; }
.sib-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.side-badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 11px;
              font-weight: 700; background: rgba(188,140,255,.16); color: #bc8cff; border: 1px solid rgba(188,140,255,.35); }
.device-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.device-tab { display: flex; align-items: center; gap: 8px; text-align: left; color: var(--text);
  background: var(--bg); border: 1px solid var(--border-soft); border-left: 3px solid var(--border);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.device-tab:hover { border-color: var(--faint); }
.device-tab.active { border-color: var(--accent); background: var(--bg-hover); }
.device-tab.row-crash  { border-left-color: var(--red); }
.device-tab.row-high   { border-left-color: var(--orange); }
.device-tab.row-normal { border-left-color: var(--accent); }
.device-tab.row-low    { border-left-color: var(--faint); }
.dt-dev { font-weight: 600; font-size: 13.5px; }
.tester-note { border-left: 3px solid var(--accent); }
.tester-note label { color: #79b8ff; }

/* project cards */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.proj-card {
  background: var(--bg2); border: 1px solid var(--border-soft); border-radius: 12px; padding: 18px;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .1s ease, border-color .12s ease;
  display: flex; flex-direction: column; gap: 12px; min-height: 118px;
}
.proj-card:hover { transform: translateY(-2px); border-color: var(--faint); }
.proj-card .avatar {
  width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; color: #fff; background: linear-gradient(135deg, #1f6feb, #3fb950);
}
.proj-card .pname { font-weight: 600; font-size: 15px; }
.proj-card .pfoot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 372px; }
.login-box .card { padding: 28px; }
.login-box h1 { text-align: center; margin: 0 0 8px; }
.login-box .sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.error { color: var(--red); font-size: 13px; }

/* log viewer */
.logview {
  background: #0a0d12; border: 1px solid var(--border); border-radius: 8px;
  max-height: 480px; overflow: auto; padding: 10px 0; font-size: 12.5px; line-height: 1.55;
}
.logview .ln { padding: 0 14px; white-space: pre-wrap; word-break: break-all; }
.logview .ln.err { color: var(--red); }
.logview .ln.warn { color: var(--amber); }
.logview .ln mark { background: #7d5b0e; color: #fff; border-radius: 2px; }

/* clip player */
.clip-frame { width: 100%; max-height: 70vh; object-fit: contain; background: #0a0d12;
              border: 1px solid var(--border); border-radius: 8px; display: block; cursor: zoom-in;
              image-rendering: auto; }
.clip-frame + .row input[type=range] { accent-color: var(--accent); }

/* issue detail — evidence (left) + notes/context (right) */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.detail-grid > .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* screenshot */
.shot { max-width: 100%; max-height: 62vh; object-fit: contain; object-position: top; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }
.shot-full {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; z-index: 50;
}
.shot-full img { max-width: 95vw; max-height: 95vh; }

/* metadata chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg3); border: 1px solid var(--border-soft); border-radius: 6px;
        padding: 4px 10px; font-size: 13px; }
.chip b { color: var(--muted); font-weight: 500; margin-right: 6px; }

/* api key reveal */
.keybox {
  background: rgba(63,185,80,.1); border: 1px solid var(--green); border-radius: 8px;
  padding: 12px 14px; margin-top: 10px; font-size: 14px; word-break: break-all;
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }

/* scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3d444d; }
