/* CrushGit portal: only what the company UI kit (crush-ui-kit, loaded first) has no part for: the page frame,
   code and diff views, the QR code. Colours and type come from the kit's tokens, so light and dark follow it.
   No inline styles anywhere (the CSP allows only these files). */
body.cg { margin: 0; min-height: 100vh; background: var(--background-app); color: var(--text-primary); font-family: var(--font-family); font-size: 14px; }

/* the top bar: brand, sections (the kit's tabs), the signed-in person */
.cg-top { display: flex; align-items: center; gap: 18px; padding: 0 20px; background: var(--background-primary); border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.cg-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text-strong); padding: 12px 0; white-space: nowrap; }
.cg-brand img { width: 22px; height: 22px; }
/* the kit's tabs scroll sideways (Bulma: nowrap, a list that does not shrink); here they wrap onto a second line instead */
.cg-top .tabs { flex: 1 1 0; min-width: 0; margin: 0; align-self: stretch; overflow: visible; white-space: normal; }
.cg-top .tabs ul { border-bottom: 0; flex-shrink: 1; flex-wrap: wrap; }
.cg-top .tabs a { padding-top: 14px; padding-bottom: 12px; }
.cg-me { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.cg-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--accent-ink); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.cg-main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; }
.cg-main > h1.title { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--text-strong); }
.cg-main .subtitle, .cg-main .card-header-title { color: var(--text-strong); }
.cg-sub { color: var(--text-secondary); margin: 0 0 14px; }
.cg-main .card { margin-bottom: 16px; }
.cg-main .card-content > :last-child { margin-bottom: 0; }
.cg-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.cg-row > .control, .cg-row > label { margin: 0; }
.cg-row .cuk-form-input, .cg-row .select select { height: 36px; box-sizing: border-box; }
.cg-row .autocomplete-input { min-height: 36px; }
.cg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.cg-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; }
.cg-facts dt { color: var(--text-secondary); }
.cg-facts dd { margin: 0; }
.cg-muted { color: var(--text-secondary); }
.cg-ok { color: var(--success-color); }
.cg-err { color: var(--error-color); }
.cg-warn { color: var(--warning-color); }
.cg-step { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin: 0 0 14px; border-radius: 6px; background: var(--info-color-light); }
.cg-step.is-fresh { background: var(--success-color-light); }
.cg-inline { display: inline-flex; gap: 6px; align-items: center; margin: 0 4px 0 0; }
.cg-inline .input { width: auto; }
.table td, .table th { vertical-align: middle; }
.table td.cg-nowrap, .table td:first-child { white-space: nowrap; }
.table td > code { word-break: break-all; }
.cg-level { font-weight: 600; }
.cg-level.is-write { color: var(--success-color); }
.cg-level.is-read { color: var(--info-color); }
.cg-via { color: var(--text-secondary); font-size: 12.5px; }

/* sign-in, setup and second-step pages: one card in the middle */
body.cg-login { display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; }
body.cg-login .card { width: 420px; max-width: 100%; }
body.cg-login .card-header-title { gap: 8px; }
body.cg-login .card-header-title img { width: 24px; height: 24px; }
body.cg-login .button { margin-top: 10px; }
.cg-or { margin: 10px 0; color: var(--text-secondary); }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 6px; }
code.cg-key, code.cg-link { word-break: break-all; user-select: all; }

/* repository pages: breadcrumbs, the file view, diffs */
.cg-crumbs { color: var(--text-secondary); margin: 0 0 4px; }
.cg-tools a { margin-right: 14px; }
code, pre, .cg-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; tab-size: 4; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
/* the kit boxes every pre (also in its dark theme): a code line is plain text in its row */
.cg-main table.code pre { background: transparent; padding: 0; border: 0; border-radius: 0; color: inherit; }
table.code { width: 100%; border-collapse: collapse; background: var(--background-primary); border: 1px solid var(--border-color); }
table.code td { padding: 0 8px; border: 0; }
table.code td.ln { width: 1%; white-space: nowrap; text-align: right; color: var(--text-secondary); user-select: none; }
table.code td.ln a { color: var(--text-secondary); }
table.code tr:target { background: var(--info-color-light); }
.cg-main pre.diff, .cg-main pre.msg { color: var(--text-primary); opacity: 1; line-height: 1.45; background: var(--background-primary); border: 1px solid var(--border-color); border-radius: 6px; padding: 10px; overflow-x: auto; }
pre.diff .add { background: var(--success-color-light); display: block; }
pre.diff .del { background: var(--error-color-light); display: block; }
pre.diff .hunk { background: var(--info-color-light); display: block; color: var(--text-secondary); }
pre.diff .file { font-weight: 700; display: block; margin-top: 8px; }
