:root {
  --bg: #F2F2F1; --surface: #FFFFFF; --surface-2: #EDEDEB; --surface-3: #E4E4E1;
  --ink: #191B1E; --ink-soft: #53565B; --ink-faint: #888C91;
  --line: #DEDDD9; --line-soft: #EAE9E5;
  --accent: #5B2BD6; --accent-2: #7C4DEE; --accent-wash: #EFEAFC;
  --good: #2F8A54; --good-wash: #E4F3EA; --warn: #A9711A; --crit: #B23B27; --crit-wash: #F7E6E1;
  --sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", ui-monospace, Consolas, monospace;
  --serif: "Hoefler Text", "Iowan Old Style", Georgia, serif;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215; --surface: #191B1F; --surface-2: #202329; --surface-3: #272B31;
    --ink: #ECEBE8; --ink-soft: #A2A6AD; --ink-faint: #74787F;
    --line: #2B2F35; --line-soft: #23272C;
    --accent: #9B6BFF; --accent-2: #B794FF; --accent-wash: #241B3C;
    --good: #5FB584; --good-wash: #17281D; --warn: #D6A24E; --crit: #E0664A; --crit-wash: #2E1913;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
code, pre, .mono { font-family: var(--mono); }

/* top bar */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 11px 20px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.brand svg { width: 22px; height: 22px; }
.brand:hover { text-decoration: none; }
.crumbs { color: var(--ink-faint); font-size: 14px; }
.crumbs a { color: var(--ink-soft); font-weight: 600; }
.spacer { flex: 1; }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* layout */
.container { max-width: 1080px; margin: 0 auto; padding: 26px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; font-size: 13.5px; font-weight: 600; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: var(--accent-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.tile .tl { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); }
.tile .tv { font-family: var(--serif); font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* repo list */
.repo-list { display: flex; flex-direction: column; gap: 12px; }
.repo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.repo-card h3 { font-family: var(--sans); font-size: 16px; }
.repo-card .desc { color: var(--ink-soft); font-size: 13.5px; margin-top: 4px; }
.badge { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; color: var(--ink-faint); letter-spacing: 0.03em; text-transform: uppercase; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-weight: 600; }
.panel-head .mono { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }

/* repo header */
.repo-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.repo-title h1 { font-family: var(--sans); font-size: 20px; }
.repo-title h1 span { color: var(--ink-faint); font-weight: 400; }
.repo-actions { display: flex; gap: 8px; margin-left: auto; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 22px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; font-size: 13.5px; color: var(--ink-soft); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

/* file list */
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.files li:last-child { border-bottom: none; }
.files .ic { color: var(--ink-faint); width: 16px; text-align: center; }
.files .sz { margin-left: auto; color: var(--ink-faint); font-family: var(--mono); font-size: 12px; }

/* clone / wget panel */
.clone { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 16px; margin-bottom: 18px; }
.clone h3 { font-family: var(--sans); font-size: 14px; margin-bottom: 10px; }
.ctx-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.ctx-toggle button { border: none; background: transparent; color: var(--ink-soft); font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.ctx-toggle button.on { background: var(--accent); color: #fff; }
.cmd-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin: 12px 0 5px; }
.cmd { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.cmd code { flex: 1; padding: 9px 12px; font-size: 12.5px; color: var(--ink); overflow-x: auto; white-space: nowrap; }
.cmd button { border: none; border-left: 1px solid var(--line); background: var(--surface-2); color: var(--ink-soft); font-size: 11px; font-weight: 700; padding: 0 12px; cursor: pointer; font-family: var(--mono); }
.cmd button:hover { color: var(--accent); }
.hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 10px; }
.ctx-note { font-size: 12px; color: var(--ink-faint); margin-top: 8px; }
.ctx-note b { color: var(--accent); }

/* code view */
pre.code { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; margin: 0; }
.readme { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px 26px; }
.readme h1, .readme h2, .readme h3 { font-family: var(--serif); margin: 18px 0 10px; }
.readme p { color: var(--ink-soft); }
.readme code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 0.88em; }
.readme pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.readme pre code { border: none; background: none; padding: 0; }

/* forms */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; max-width: 560px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field textarea, .field input[type=password] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px;
}
.field textarea { min-height: 70px; resize: vertical; }
.radio-row { display: flex; gap: 18px; }
.radio-row label { display: flex; gap: 7px; align-items: center; font-weight: 500; }
.error { background: var(--crit-wash); color: var(--crit); border: 1px solid var(--crit); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }

/* login */
.login-wrap { max-width: 360px; margin: 8vh auto; padding: 0 20px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 20px; font-weight: 700; font-size: 18px; }
.login-brand svg { width: 26px; height: 26px; }

footer.foot { max-width: 1080px; margin: 0 auto; padding: 22px 20px; color: var(--ink-faint); font-family: var(--mono); font-size: 12px; border-top: 1px solid var(--line); }

/* topbar extras */
.search-mini input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--ink); width: 170px; }
.navlink { color: var(--ink-soft); font-weight: 600; font-size: 13.5px; }

/* storage indicator */
.storage { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink-soft); font-size: 12px; font-family: var(--mono); white-space: nowrap; }
.storage .hdd { width: 15px; height: 15px; color: var(--accent); flex: none; }
.storage .st-txt { color: var(--ink); font-weight: 600; }
.storage .st-bar { width: 46px; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.storage .st-bar > span { display: block; height: 100%; background: var(--accent); }
.storage .st-free { color: var(--ink-faint); }
@media (max-width: 860px) { .storage .st-free, .storage .st-bar { display: none; } }
@media (max-width: 560px) { .storage .st-txt { display: none; } }
.tabcount { font-family: var(--mono); font-size: 11px; background: var(--surface-2); border-radius: 20px; padding: 0 7px; color: var(--ink-faint); }
.tabcount.alert { background: var(--crit-wash); color: var(--crit); }

/* generic state pills */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; font-family: var(--mono); padding: 3px 10px; border-radius: 20px; }
.state.open { background: var(--good-wash); color: var(--good); }
.state.closed { background: var(--crit-wash); color: var(--crit); }
.state.merged { background: var(--accent-wash); color: var(--accent); }
.state.success { background: var(--good-wash); color: var(--good); }
.state.failed { background: var(--crit-wash); color: var(--crit); }
.state.running, .state.queued { background: var(--accent-wash); color: var(--accent); }
.state.no-config { background: var(--surface-2); color: var(--ink-faint); }

/* list rows (issues, pulls, runs, releases) */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.list li:last-child { border-bottom: none; }
.list .li-main { flex: 1; min-width: 0; }
.list .li-main a { font-weight: 600; font-size: 14.5px; }
.list .li-meta { color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
.list .li-right { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.filterbar { display: flex; gap: 14px; margin-bottom: 14px; align-items: center; }
.filterbar a { font-size: 13.5px; color: var(--ink-soft); font-weight: 600; }
.filterbar a.on { color: var(--accent); }

/* labels */
.label { font-size: 11px; font-weight: 700; border-radius: 20px; padding: 2px 9px; color: #fff; }

/* timeline / comments */
.timeline { display: flex; flex-direction: column; gap: 14px; margin: 18px 0; }
.comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.comment .c-head { display: flex; gap: 8px; align-items: center; padding: 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); font-size: 13px; border-radius: var(--r) var(--r) 0 0; }
.comment .c-head b { font-weight: 700; }
.comment .c-body { padding: 14px; color: var(--ink-soft); font-size: 14px; white-space: pre-wrap; }
.comment .c-body pre { white-space: pre; overflow-x: auto; background: var(--surface-2); padding: 10px; border-radius: 8px; }

/* diff */
.diff { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.5; }
.diff pre { margin: 0; padding: 14px 16px; }
.diff pre span { display: block; white-space: pre; min-height: 1.5em; }
.diff .h { color: var(--accent); font-weight: 700; }
.diff .add { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); display: block; }
.diff .del { color: var(--crit); background: color-mix(in srgb, var(--crit) 12%, transparent); display: block; }
.diff .at { color: var(--ink-faint); display: block; }

/* alert rows with severity stripe */
.alert-row { border-left: 3px solid var(--crit); }

/* insights bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { background: var(--accent); height: 100%; }

/* data tables */
table.data { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
table.data th { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); background: var(--surface-2); }
table.data tr:last-child td { border-bottom: none; }

/* token reveal */
.token-reveal { background: var(--good-wash); border: 1px solid var(--good); color: var(--ink); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; font-size: 13px; }
.token-reveal code { display: block; margin-top: 6px; font-size: 13px; word-break: break-all; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }

.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 16px; }
.section-h { font-family: var(--sans); font-size: 15px; font-weight: 700; margin: 22px 0 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 13px; }
.empty { text-align: center; color: var(--ink-faint); padding: 30px; }

/* drag & drop upload */
.dropzone { display:block; border:2px dashed var(--line); border-radius:12px; padding:38px 20px; text-align:center; color:var(--ink-faint); background:var(--surface); cursor:pointer; transition:.15s }
.dropzone:hover { border-color:var(--accent-2) }
.dropzone.drag { border-color:var(--accent); background:var(--accent-wash); color:var(--accent) }
.dropzone .big { font-size:16px; color:var(--ink); font-weight:700; margin-bottom:4px }
.dropzone .big::before { content:"⇪"; display:block; font-size:28px; color:var(--accent); margin-bottom:6px }
.filelist { list-style:none; margin:14px 0 0; padding:0 }
.filelist li { display:flex; justify-content:space-between; gap:10px; padding:8px 12px; border:1px solid var(--line); border-radius:8px; margin-bottom:6px; font-size:13px; background:var(--surface) }
.filelist .fsz { color:var(--ink-faint); font-family:var(--mono); font-size:12px; white-space:nowrap }
.progress { height:9px; background:var(--surface-2); border:1px solid var(--line); border-radius:6px; overflow:hidden; margin:10px 0 2px }
.progress .bar { height:100%; width:0; background:var(--accent); transition:width .12s ease }
.upbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding-bottom:10px; border-bottom:1px solid var(--line-soft); margin-bottom:8px }
.upbar .pct { font-family:var(--mono); font-size:12px; font-weight:700; color:var(--accent) }

/* notifications bell */
.bell { position: relative; font-size: 16px; text-decoration: none; line-height: 1; }
.bell:hover { text-decoration: none; }
.bell-badge { position: absolute; top: -8px; right: -9px; background: var(--accent); color: #fff; font-family: var(--mono); font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* merge gating box */
.gate { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; background: var(--surface); }
.gate.ok { border-color: var(--good); }
.gate.blocked { border-color: var(--warn); }
.gate .g-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.gate ul.reasons { margin: 6px 0 0; padding-left: 20px; color: var(--warn); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); padding: 3px 0; }
.check .ico { font-weight: 700; }
.check .ico.pass { color: var(--good); } .check .ico.fail { color: var(--warn); }

/* reviews */
.review { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; }
.rev-state { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.rev-state.approved { background: var(--good-wash); color: var(--good); }
.rev-state.changes_requested { background: var(--crit-wash); color: var(--crit); }
.rev-state.commented { background: var(--surface-2); color: var(--ink-faint); }

/* inline line comments in diff */
.line-comment { background: var(--accent-wash); border-left: 3px solid var(--accent); padding: 8px 12px; margin: 2px 0; font-size: 13px; font-family: var(--sans); white-space: normal; }
.line-comment b { color: var(--accent); }
details.linebox { margin: 10px 0; }
details.linebox summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; }
