/* ==========================================================================
   Dialtone Virtual Git — design system
   Tokens follow the Dialtone Tech brand guide: Deep Navy / Signal Blue /
   Quantum Cyan, Manrope headings, Inter body, 4px spacing, 12px controls,
   18px cards, soft shadows, 1.25 type scale.
   ========================================================================== */

:root {
    --navy: #0F172A;
    --signal: #3B82F6;
    --cyan: #06B6D4;
    --violet: #7C3AED;
    --cloud: #F8FAFC;
    --slate-ink: #1E293B;

    --primary: #0F172A;
    --on-primary: #F8FAFC;
    --secondary: #3B82F6;
    --accent: #06B6D4;
    --neutral: #414653;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F7F7F8;
    --surface-muted: #EBECEF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --link: #1D4ED8;
    --info: #0284C7;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --merged: #7C3AED;

    --info-bg: #E0F2FE;
    --success-bg: #DCFCE7;
    --warning-bg: #FEF3C7;
    --danger-bg: #FEE2E2;
    --merged-bg: #EDE9FE;
    --focus: 0 0 0 3px rgba(59, 130, 246, .35);

    --header-bg: #0F172A;
    --header-text: #F8FAFC;
    --header-muted: #94A3B8;

    --diff-add-bg: #E6F7EC;
    --diff-add-num: #CDEFD8;
    --diff-del-bg: #FDECEC;
    --diff-del-num: #F9D7D7;
    --diff-hunk-bg: #EFF6FF;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-card: 18px;
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
    --shadow-pop: 0 8px 32px rgba(15, 23, 42, .16);

    --font-head: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", SFMono-Regular, Consolas, "Liberation Mono", monospace;

    --fs-xs: 10.2px;
    --fs-sm: 12.8px;
    --fs-base: 16px;
    --fs-lg: 20px;
    --fs-xl: 25px;
    --fs-2xl: 31.2px;
    --fs-3xl: 39.1px;
    --fs-4xl: 48.8px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #7992CE; --on-primary: #0F172A; --secondary: #3B82F6; --accent: #06B6D4; --neutral: #535A6A;
        --bg: #1E2025; --surface: #1E293B; --surface-2: #232B3A; --surface-muted: #414653;
        --text: #F7F7F8; --text-muted: #94A3B8; --border: #3A4252; --border-strong: #535A6A; --link: #7DB2FF;
        --info: #38BDF8; --info-bg: rgba(56, 189, 248, .12); --success-bg: rgba(22, 163, 74, .16);
        --warning-bg: rgba(217, 119, 6, .16); --danger-bg: rgba(220, 38, 38, .16); --merged: #A78BFA; --merged-bg: rgba(124, 58, 237, .2);
        --header-bg: #0F172A; --header-muted: #94A3B8;
        --diff-add-bg: rgba(22, 163, 74, .14); --diff-add-num: rgba(22, 163, 74, .24);
        --diff-del-bg: rgba(220, 38, 38, .14); --diff-del-num: rgba(220, 38, 38, .24); --diff-hunk-bg: rgba(59, 130, 246, .12);
        --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
        --shadow-pop: 0 8px 32px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --primary: #7992CE; --on-primary: #0F172A; --secondary: #3B82F6; --accent: #06B6D4; --neutral: #535A6A;
    --bg: #1E2025; --surface: #1E293B; --surface-2: #232B3A; --surface-muted: #414653;
    --text: #F7F7F8; --text-muted: #94A3B8; --border: #3A4252; --border-strong: #535A6A; --link: #7DB2FF;
    --info: #38BDF8; --info-bg: rgba(56, 189, 248, .12); --success-bg: rgba(22, 163, 74, .16);
    --warning-bg: rgba(217, 119, 6, .16); --danger-bg: rgba(220, 38, 38, .16); --merged: #A78BFA; --merged-bg: rgba(124, 58, 237, .2);
    --header-bg: #0F172A; --header-muted: #94A3B8;
    --diff-add-bg: rgba(22, 163, 74, .14); --diff-add-num: rgba(22, 163, 74, .24);
    --diff-del-bg: rgba(220, 38, 38, .14); --diff-del-num: rgba(220, 38, 38, .24); --diff-hunk-bg: rgba(59, 130, 246, .12);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-pop: 0 8px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0 0 12px; color: var(--text); }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); font-weight: 600; }
h4 { font-size: var(--fs-base); font-weight: 600; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 12px; }
code, pre, kbd { font-family: var(--font-mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.mt-0 { margin-top: 0 !important; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-merged { color: var(--merged); } .text-warning { color: var(--warning); }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 20px; height: 20px; }
.icon.xl { width: 32px; height: 32px; }

/* ---------- Header ---------- */

.site-header {
    background: var(--header-bg);
    color: var(--header-text);
    position: sticky; top: 0; z-index: 50;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.site-header .inner { max-width: 1440px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--header-text); text-decoration: none !important; flex: none; }
.brand img.logo { height: 30px; display: block; }
.brand img.mark { height: 32px; display: none; }
.brand .divider { width: 1px; height: 24px; background: rgba(248, 250, 252, .25); }
.brand .site-name { font-family: var(--font-head); font-weight: 700; font-size: var(--fs-base); letter-spacing: -.01em; white-space: nowrap; }
.header-search { flex: 1 1 auto; max-width: 360px; position: relative; }
.header-search input {
    width: 100%; height: 36px; border-radius: var(--radius); border: 1px solid rgba(248, 250, 252, .18);
    background: rgba(248, 250, 252, .06); color: var(--header-text); padding: 0 12px 0 36px; font: inherit; font-size: var(--fs-sm);
}
.header-search input::placeholder { color: var(--header-muted); }
.header-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6, 182, 212, .3); background: rgba(248, 250, 252, .1); }
.header-search .icon { position: absolute; left: 12px; top: 10px; color: var(--header-muted); }
.header-nav { display: flex; gap: 4px; }
.header-nav a { color: var(--header-text); font-weight: 600; font-size: var(--fs-sm); padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; }
.header-nav a:hover, .header-nav a.active { background: rgba(248, 250, 252, .08); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
    color: var(--header-text); background: transparent; border: 1px solid rgba(248, 250, 252, .18); cursor: pointer; font: inherit; font-size: var(--fs-sm); font-weight: 600;
    text-decoration: none !important;
}
.header-btn:hover { background: rgba(248, 250, 252, .08); }
.header-btn.solid { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.header-btn.solid:hover { filter: brightness(1.05); }
.header-btn.icon-only { width: 36px; justify-content: center; padding: 0; }

/* ---------- Dropdown ---------- */

.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop);
    padding: 8px; display: flex; flex-direction: column;
}
.dropdown-menu.left { left: 0; right: auto; }
.dropdown-menu .item, .dropdown-menu a, .dropdown-menu button.item {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text);
    font-size: var(--fs-sm); text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; font-family: inherit;
}
.dropdown-menu a:hover, .dropdown-menu .item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .header { padding: 8px 12px; font-size: var(--fs-sm); color: var(--text-muted); }
.dropdown-menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- Layout ---------- */

.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.container.narrow { max-width: 880px; }
.container.xnarrow { max-width: 560px; }
.page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-title h1 { margin: 0; }
.layout-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 32px; align-items: start; }
.layout-sidebar-left { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 32px; align-items: start; }
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; }
.site-footer .inner { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; gap: 16px; justify-content: space-between; color: var(--text-muted); font-size: var(--fs-sm); flex-wrap: wrap; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
    text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.2); }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary); filter: brightness(1.08); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--radius-sm); gap: 6px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-base); }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn .count { background: var(--surface-muted); border-radius: 999px; padding: 0 8px; font-size: var(--fs-xs); line-height: 18px; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-sm); color: var(--text-muted); }
.field .error, .validation-message { font-size: var(--fs-sm); color: var(--danger); }
.input, .select, .textarea {
    width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 8px 12px; min-height: 36px;
    transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: var(--font-mono); font-size: var(--fs-sm); min-height: 480px; tab-size: 4; white-space: pre; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--secondary); box-shadow: var(--focus); }
.input.invalid, .input.modified.invalid { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; height: auto; }
.input-prefix { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }
.input-prefix + .input { border-radius: 0 var(--radius) var(--radius) 0; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--secondary); }
.check .title { font-weight: 600; font-size: var(--fs-sm); }
.check .desc { color: var(--text-muted); font-size: var(--fs-sm); }
.radio-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; cursor: pointer; margin-bottom: 8px; background: var(--surface); }
.radio-card:has(input:checked) { border-color: var(--secondary); box-shadow: 0 0 0 1px var(--secondary); }
.radio-card input { margin-top: 4px; accent-color: var(--secondary); }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Cards / boxes ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-soft); padding: 20px; }
.card.flat { box-shadow: none; }
.card.p0 { padding: 0; overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); min-height: 52px; flex-wrap: wrap; }
.card-header h3, .card-header h4 { margin: 0; }
.card-body { padding: 16px 20px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.card.danger { border-color: rgba(220, 38, 38, .45); }
.card.danger .card-header { background: var(--danger-bg); color: var(--danger); }
.section-title { font-family: var(--font-head); font-size: var(--fs-base); font-weight: 700; margin: 0 0 12px; }

/* ---------- Badges & alerts ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 600;
    border: 1px solid var(--border-strong); color: var(--text-muted); background: transparent; line-height: 18px; white-space: nowrap;
}
.badge.solid-open { background: var(--success); border-color: var(--success); color: #fff; }
.badge.solid-closed { background: var(--danger); border-color: var(--danger); color: #fff; }
.badge.solid-merged { background: var(--merged); border-color: var(--merged); color: #fff; }
.badge.info { color: var(--info); border-color: currentColor; }
.badge.accent { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.badge.lg { padding: 6px 14px; font-size: var(--fs-sm); }
.counter { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-muted); font-size: var(--fs-xs); font-weight: 600; line-height: 18px; text-align: center; color: var(--text); }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid; font-size: var(--fs-sm); margin-bottom: 16px; }
.alert .icon { margin-top: 2px; }
.alert-info { background: var(--info-bg); border-color: rgba(2, 132, 199, .3); color: var(--text); }
.alert-info .icon { color: var(--info); }
.alert-success { background: var(--success-bg); border-color: rgba(22, 163, 74, .3); }
.alert-success .icon { color: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: rgba(217, 119, 6, .35); }
.alert-warning .icon { color: var(--warning); }
.alert-danger { background: var(--danger-bg); border-color: rgba(220, 38, 38, .35); }
.alert-danger .icon { color: var(--danger); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--text); font-size: var(--fs-sm); font-weight: 600;
    text-decoration: none; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; font-family: inherit;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tabs a:hover, .tabs button:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active, .tabs button.active { border-bottom-color: var(--cyan); }
.tabs .icon { color: var(--text-muted); }
.pill-tabs { display: inline-flex; gap: 4px; background: var(--surface-muted); padding: 4px; border-radius: var(--radius); }
.pill-tabs button, .pill-tabs a { border: 0; background: transparent; padding: 6px 12px; border-radius: var(--radius-sm); font: inherit; font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); cursor: pointer; text-decoration: none; }
.pill-tabs .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; position: relative; }
.side-nav a:hover { background: var(--surface-muted); }
.side-nav a.active { background: var(--surface-muted); font-weight: 600; }
.side-nav a.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: var(--cyan); }
.side-nav .heading { font-size: var(--fs-sm); color: var(--text-muted); padding: 16px 12px 4px; font-weight: 600; }

/* ---------- Lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row .title { font-weight: 600; color: var(--text); }
.list-row .title:hover { color: var(--link); }
.list-row .meta { font-size: var(--fs-sm); color: var(--text-muted); }
.list-empty { padding: 40px 16px; text-align: center; color: var(--text-muted); }

.repo-item { padding: 20px 0; border-bottom: 1px solid var(--border); }
.repo-item:last-child { border-bottom: 0; }
.repo-item h3 { margin: 0 0 4px; font-size: var(--fs-lg); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.repo-item p { color: var(--text-muted); margin: 0 0 8px; font-size: var(--fs-sm); }
.repo-item .meta { display: flex; gap: 16px; font-size: var(--fs-sm); color: var(--text-muted); flex-wrap: wrap; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--surface-2); }

/* ---------- Avatars ---------- */

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-family: var(--font-head); font-weight: 700; color: #fff; flex: none; user-select: none; text-transform: uppercase; }

/* ---------- Repository header ---------- */

.repo-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.repo-head .inner { max-width: 1280px; margin: 0 auto; padding: 20px 24px 0; }
.repo-title { display: flex; align-items: center; gap: 8px; font-size: var(--fs-lg); font-family: var(--font-head); flex-wrap: wrap; }
.repo-title a { color: var(--link); }
.repo-title .name { font-weight: 700; }
.repo-title .sep { color: var(--text-muted); }
.repo-head .tabs { border-bottom: 0; margin-top: 16px; }

.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: var(--fs-base); font-family: var(--font-head); }
.breadcrumb a { font-weight: 600; }
.breadcrumb .sep { color: var(--text-muted); }
.breadcrumb .current { font-weight: 700; }

/* ---------- File browser ---------- */

.commit-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); flex-wrap: wrap; }
.commit-bar .msg { color: var(--text); }
.files { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); table-layout: fixed; }
.files td { padding: 8px 16px; border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files tr:first-child td { border-top: 0; }
.files tr:hover td { background: var(--surface-2); }
.files td.name { width: 32%; }
.files td.name a { color: var(--text); }
.files td.name a:hover { color: var(--link); }
.files td.when { width: 140px; text-align: right; color: var(--text-muted); }
.files td.msg a { color: var(--text-muted); }
.files .icon.dir { color: var(--signal); fill: rgba(59, 130, 246, .18); }
.files .icon.file { color: var(--text-muted); }

.readme { margin-top: 24px; }
.readme .card-header { gap: 8px; }

/* ---------- Code view ---------- */

.code-view { display: flex; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 20px; overflow: auto; background: var(--surface); }
.code-view .gutter { flex: none; text-align: right; padding: 8px 0; user-select: none; color: var(--text-muted); border-right: 1px solid var(--border); background: var(--surface-2); }
.code-view .gutter a { display: block; padding: 0 12px 0 16px; color: inherit; text-decoration: none; min-width: 48px; }
.code-view .gutter a:hover { color: var(--text); }
.code-view .gutter a.hl { background: rgba(6, 182, 212, .18); color: var(--text); }
.code-view pre { margin: 0; padding: 8px 16px; flex: 1 1 auto; min-width: 0; overflow: visible; }
.code-view pre code { font-family: inherit; background: none !important; padding: 0 !important; white-space: pre; display: block; }
.blob-media { padding: 32px; text-align: center; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 20px 20px; }
.blob-media img { max-width: 100%; max-height: 70vh; }
.blob-notice { padding: 48px 24px; text-align: center; color: var(--text-muted); }
.blob-notice .icon.xl { color: var(--text-muted); margin-bottom: 12px; }

/* highlight.js themes mapped to brand tokens */
.hljs-comment, .hljs-quote { color: #64748B; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: #7C3AED; }
.hljs-string, .hljs-attr-value, .hljs-regexp, .hljs-addition { color: #0F766E; }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-variable.constant_ { color: #B45309; }
.hljs-title, .hljs-title.function_, .hljs-section { color: #1D4ED8; }
.hljs-type, .hljs-title.class_, .hljs-class .hljs-title { color: #0E7490; }
.hljs-attr, .hljs-attribute, .hljs-name, .hljs-tag { color: #1E40AF; }
.hljs-meta, .hljs-meta .hljs-keyword { color: #475569; }
.hljs-deletion { color: #B91C1C; }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }
:root[data-theme="dark"] .hljs-keyword, :root[data-theme="dark"] .hljs-selector-tag, :root[data-theme="dark"] .hljs-literal, :root[data-theme="dark"] .hljs-built_in { color: #C4B5FD; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-attr-value, :root[data-theme="dark"] .hljs-regexp, :root[data-theme="dark"] .hljs-addition { color: #5EEAD4; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-symbol, :root[data-theme="dark"] .hljs-bullet { color: #FCD34D; }
:root[data-theme="dark"] .hljs-title, :root[data-theme="dark"] .hljs-title.function_, :root[data-theme="dark"] .hljs-section { color: #93C5FD; }
:root[data-theme="dark"] .hljs-type, :root[data-theme="dark"] .hljs-title.class_ { color: #67E8F9; }
:root[data-theme="dark"] .hljs-attr, :root[data-theme="dark"] .hljs-attribute, :root[data-theme="dark"] .hljs-name, :root[data-theme="dark"] .hljs-tag { color: #A5B4FC; }
:root[data-theme="dark"] .hljs-comment, :root[data-theme="dark"] .hljs-quote, :root[data-theme="dark"] .hljs-meta { color: #94A3B8; }
:root[data-theme="dark"] .hljs-deletion { color: #FCA5A5; }

/* ---------- Diff ---------- */

.diff-file { margin-bottom: 16px; }
/* overflow: clip keeps rounded corners without making the card a scroll container, so the sticky header tracks the page. */
.card.p0.diff-file { overflow: clip; }
.diff-file .card-header { position: sticky; top: 64px; z-index: 5; font-size: var(--fs-sm); border-radius: var(--radius-card) var(--radius-card) 0 0; }
.diff-stat { display: inline-flex; gap: 2px; margin-left: 4px; }
.diff-stat i { width: 8px; height: 8px; border-radius: 2px; background: var(--surface-muted); display: inline-block; }
.diff-stat i.a { background: var(--success); } .diff-stat i.d { background: var(--danger); }
.diff-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 20px; }
.diff-table td { padding: 0 8px; vertical-align: top; }
.diff-table td.num { width: 1%; min-width: 48px; text-align: right; color: var(--text-muted); user-select: none; padding: 0 8px; white-space: nowrap; }
.diff-table td.code { white-space: pre-wrap; word-break: break-all; width: 98%; }
.diff-table td.code::before { display: inline-block; width: 16px; content: " "; user-select: none; color: var(--text-muted); }
.diff-table tr.add td { background: var(--diff-add-bg); } .diff-table tr.add td.num { background: var(--diff-add-num); }
.diff-table tr.add td.code::before { content: "+"; color: var(--success); }
.diff-table tr.del td { background: var(--diff-del-bg); } .diff-table tr.del td.num { background: var(--diff-del-num); }
.diff-table tr.del td.code::before { content: "-"; color: var(--danger); }
.diff-table tr.hunk td { background: var(--diff-hunk-bg); color: var(--text-muted); padding: 4px 8px; }
.diff-table tr.hunk td.code::before { content: ""; width: 0; }
.diff-summary { display: flex; gap: 16px; align-items: center; font-size: var(--fs-sm); margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- Markdown ---------- */

.markdown-body { font-size: var(--fs-base); line-height: 1.65; word-wrap: break-word; max-width: 100%; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2 { padding-bottom: 8px; border-bottom: 1px solid var(--border); margin: 24px 0 16px; }
.markdown-body h1 { font-size: var(--fs-2xl); } .markdown-body h2 { font-size: var(--fs-xl); }
.markdown-body h3 { font-size: var(--fs-lg); margin: 24px 0 12px; }
.markdown-body p, .markdown-body ul, .markdown-body ol, .markdown-body blockquote, .markdown-body table, .markdown-body pre { margin: 0 0 16px; }
.markdown-body ul, .markdown-body ol { padding-left: 2em; }
.markdown-body li + li { margin-top: 4px; }
.markdown-body code { background: var(--surface-muted); padding: 2px 6px; border-radius: 6px; font-size: 85%; }
.markdown-body pre { background: var(--surface-2); border: 1px solid var(--border); padding: 16px; border-radius: var(--radius); overflow: auto; font-size: var(--fs-sm); line-height: 1.5; }
.markdown-body pre code { background: none; padding: 0; font-size: inherit; }
.markdown-body blockquote { border-left: 4px solid var(--border-strong); padding: 0 16px; color: var(--text-muted); }
.markdown-body table { border-collapse: collapse; display: block; overflow: auto; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 12px; }
.markdown-body th { background: var(--surface-2); }
.markdown-body img { max-width: 100%; }
.markdown-body hr { margin: 24px 0; }
.markdown-body input[type=checkbox] { margin-right: 6px; }

/* ---------- Timeline (issues / PRs) ---------- */

.issue-title { font-size: var(--fs-2xl); font-weight: 600; margin: 0; }
.issue-title .num { color: var(--text-muted); font-weight: 400; }
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; left: 20px; top: 0; bottom: 0; width: 2px; background: var(--border); z-index: 0; }
.comment { display: flex; gap: 16px; position: relative; margin-bottom: 20px; }
.comment .card { flex: 1 1 auto; min-width: 0; padding: 0; }
.comment .card-header { background: var(--surface-2); font-size: var(--fs-sm); min-height: 44px; padding: 8px 16px; }
.comment.author .card-header { background: rgba(59, 130, 246, .08); }
.comment .avatar { position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--bg); }
.timeline-event { display: flex; align-items: center; gap: 12px; margin: 0 0 20px 8px; font-size: var(--fs-sm); color: var(--text-muted); position: relative; z-index: 1; }
.timeline-event .dot { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-muted); color: var(--text); box-shadow: 0 0 0 4px var(--bg); }
.timeline-event .dot.closed { background: var(--danger); color: #fff; }
.timeline-event .dot.reopened { background: var(--success); color: #fff; }
.timeline-event .dot.merged { background: var(--merged); color: #fff; }
.timeline-event .dot .icon { width: 14px; height: 14px; }
.merge-box { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.merge-box .section { display: flex; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--border); align-items: flex-start; }
.merge-box .section:first-child { border-top: 0; }
.merge-box .status-icon { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.status-ok { background: var(--success); } .status-bad { background: var(--danger); } .status-merged { background: var(--merged); } .status-neutral { background: var(--neutral); }

.md-editor .pill-tabs { margin-bottom: 8px; }
.md-editor .preview { min-height: 140px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--surface); }

/* ---------- Clone box ---------- */

.clone-menu { width: 400px; padding: 16px; }
.clone-menu h4 { margin-bottom: 8px; font-size: var(--fs-sm); }
.copy-field { display: flex; }
.copy-field input { font-family: var(--font-mono); font-size: var(--fs-sm); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.copy-field .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; height: auto; }

.code-block { background: var(--navy); color: #E2E8F0; border-radius: var(--radius); padding: 16px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.7; overflow-x: auto; white-space: pre; }
.code-block .c { color: #94A3B8; }

/* ---------- Ref selector ---------- */

.ref-menu { width: 320px; padding: 0; }
.ref-menu .ref-filter { padding: 12px; border-bottom: 1px solid var(--border); }
.ref-menu .ref-list { max-height: 320px; overflow: auto; padding: 8px; }
.ref-menu .pill-tabs { margin: 8px 12px 0; }

/* ---------- Home / hero ---------- */

.hero { background: var(--navy); color: var(--cloud); border-radius: var(--radius-card); padding: 48px; position: relative; overflow: hidden; margin-bottom: 32px; }
.hero h1 { color: var(--cloud); font-size: var(--fs-3xl); max-width: 720px; }
.hero p { color: #CBD5E1; font-size: var(--fs-lg); max-width: 640px; }
.hero .glow { position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(6, 182, 212, .35), transparent 65%); pointer-events: none; }
.hero .dots { position: absolute; right: 48px; bottom: 40px; display: grid; grid-template-columns: repeat(3, 14px); gap: 10px; opacity: .9; }
.hero .dots i { width: 14px; height: 14px; border-radius: 50%; display: block; }
.feed-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .what { line-height: 1.5; }
.feed-item .detail { margin-top: 6px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; box-shadow: var(--shadow-soft); }
.stat .label { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.stat .value { font-family: var(--font-head); font-size: var(--fs-2xl); font-weight: 700; margin-top: 4px; }
.meter { height: 8px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.meter > div { height: 100%; background: var(--secondary); border-radius: 999px; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .icon.xl { color: var(--text-muted); margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 8px; }

/* ---------- Auth / setup ---------- */

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { background: var(--navy); color: var(--cloud); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-brand img { height: 44px; align-self: flex-start; }
.auth-brand h2 { color: var(--cloud); font-size: var(--fs-3xl); max-width: 480px; margin-top: 48px; }
.auth-brand p { color: #CBD5E1; max-width: 440px; font-size: var(--fs-lg); }
.auth-brand .glow { position: absolute; left: -160px; bottom: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(6, 182, 212, .28), transparent 65%); }
.auth-brand ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; color: #E2E8F0; }
.auth-brand li { display: flex; gap: 12px; align-items: center; }
.auth-brand li .icon { color: var(--cyan); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: 8px; }

.setup-steps { display: flex; flex-direction: column; gap: 4px; margin-top: 40px; position: relative; z-index: 1; }
.setup-step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: #94A3B8; font-weight: 600; font-size: var(--fs-sm); }
.setup-step .n { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #475569; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-sm); }
.setup-step.current { background: rgba(248, 250, 252, .06); color: var(--cloud); }
.setup-step.current .n { border-color: var(--cyan); color: var(--cyan); }
.setup-step.done { color: #CBD5E1; }
.setup-step.done .n { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }
.setup-panel { width: 100%; max-width: 620px; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: var(--fs-sm); margin-top: 6px; }
.check-line.ok { color: var(--success); } .check-line.bad { color: var(--danger); }
.review dl { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: var(--fs-sm); }
.review dt { color: var(--text-muted); font-weight: 600; }
.review dd { margin: 0; word-break: break-all; }

/* ---------- Upload ---------- */

.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-card); padding: 48px 24px; text-align: center; background: var(--surface); transition: border-color .12s, background .12s; cursor: pointer; }
.dropzone.over { border-color: var(--cyan); background: rgba(6, 182, 212, .06); }
.progress { height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--signal), var(--cyan)); transition: width .2s; }

/* ---------- Toast / misc ---------- */

.token-reveal { font-family: var(--font-mono); background: var(--success-bg); border: 1px solid rgba(22, 163, 74, .35); border-radius: var(--radius); padding: 12px 16px; word-break: break-all; }
.lang-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.kbd { font-family: var(--font-mono); font-size: var(--fs-xs); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--text-muted); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { display: inline-block; height: 12px; width: 120px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-muted), var(--surface-2), var(--surface-muted)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

#blazor-error-ui {
    background: var(--danger-bg); color: var(--text); border-top: 1px solid var(--danger); bottom: 0; box-shadow: var(--shadow-pop);
    display: none; left: 0; padding: 12px 24px; position: fixed; width: 100%; z-index: 1000; font-size: var(--fs-sm);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 16px; top: 10px; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .layout-sidebar, .layout-sidebar-left { grid-template-columns: minmax(0, 1fr); }
    .header-nav { display: none; }
}
@media (max-width: 768px) {
    .container { padding: 16px; }
    .site-header .inner { padding: 0 16px; gap: 8px; }
    .brand img.logo, .brand .divider { display: none; }
    .brand img.mark { display: block; }
    .brand .site-name { display: none; }
    .header-search { max-width: none; }
    .header-btn .label { display: none; }
    .repo-head .inner { padding: 16px 16px 0; }
    .files td.msg, .files td.when { display: none; }
    .files td.name { width: auto; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-brand { padding: 24px; }
    .auth-brand h2, .auth-brand p, .auth-brand ul { display: none; }
    .setup-steps { margin-top: 16px; flex-direction: row; overflow-x: auto; }
    .setup-step .label { display: none; }
    .hero { padding: 32px 24px; }
    .hero h1 { font-size: var(--fs-2xl); }
    .clone-menu, .ref-menu { width: min(92vw, 400px); }
    .review dl { grid-template-columns: minmax(0, 1fr); }
    .diff-file .card-header { position: static; }
    .spread > .row { flex-wrap: wrap; min-width: 0; }
    .spread .input, .spread .select { width: 100% !important; max-width: 100% !important; }
}
