/* ============================================================
   project-hub — Dark Ops Command Center
   Overrides on Pico CSS classless
   ============================================================ */

/* --- Color system --- */
:root {
    --hub-bg-deep: #0c0e14;
    --hub-bg: #12151e;
    --hub-bg-raised: #1a1e2e;
    --hub-bg-card: #1e2235;
    --hub-border: #2a2f45;
    --hub-border-subtle: #1e2235;
    --hub-text: #c8cdd8;
    --hub-text-muted: #6b7394;
    --hub-text-bright: #e8ecf4;
    --hub-accent: #22d3ee;
    --hub-accent-dim: rgba(34, 211, 238, 0.15);
    --hub-accent-glow: rgba(34, 211, 238, 0.3);
    --hub-success: #34d399;
    --hub-danger: #f87171;
    --hub-warning: #fbbf24;
    --hub-info: #60a5fa;
    --hub-severity-critical: #ef4444;
    --hub-severity-high: #f97316;
    --hub-severity-medium: #eab308;
    --hub-severity-low: #6b7280;
    --hub-radius: 0.5rem;
    --hub-radius-sm: 0.25rem;
    --hub-font-mono: 'Fira Code', 'Cascadia Code', 'SF Mono', 'Consolas', monospace;
    --hub-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --hub-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Force dark theme on Pico --- */
[data-theme="dark"] {
    --pico-primary: var(--hub-accent);
    --pico-background-color: var(--hub-bg);
    --pico-card-background-color: var(--hub-bg-card);
    --pico-card-border-color: var(--hub-border);
    --pico-color: var(--hub-text);
    --pico-h1-color: var(--hub-text-bright);
    --pico-h2-color: var(--hub-text-bright);
    --pico-h3-color: var(--hub-text-bright);
    --pico-h4-color: var(--hub-text-bright);
    --pico-muted-color: var(--hub-text-muted);
    --pico-muted-border-color: var(--hub-border);
    --pico-table-border-color: var(--hub-border-subtle);
    --pico-code-background-color: rgba(34, 211, 238, 0.08);
    --pico-code-color: var(--hub-accent);
}

/* Light theme overrides */
[data-theme="light"] {
    --hub-bg-deep: #f0f2f5;
    --hub-bg: #f8f9fb;
    --hub-bg-raised: #ffffff;
    --hub-bg-card: #ffffff;
    --hub-border: #e2e5ec;
    --hub-border-subtle: #edf0f5;
    --hub-text: #334155;
    --hub-text-muted: #64748b;
    --hub-text-bright: #0f172a;
    --hub-accent: #0891b2;
    --hub-accent-dim: rgba(8, 145, 178, 0.08);
    --hub-accent-glow: rgba(8, 145, 178, 0.15);
    --hub-success: #059669;
    --hub-danger: #dc2626;
    --hub-warning: #d97706;
    --hub-info: #2563eb;
    --hub-severity-critical: #dc2626;
    --hub-severity-high: #ea580c;
    --hub-severity-medium: #ca8a04;
    --hub-severity-low: #6b7280;
    --pico-primary: var(--hub-accent);
    --pico-background-color: var(--hub-bg);
    --pico-card-background-color: var(--hub-bg-card);
    --pico-card-border-color: var(--hub-border);
    --pico-color: var(--hub-text);
    --pico-h1-color: var(--hub-text-bright);
    --pico-h2-color: var(--hub-text-bright);
    --pico-h3-color: var(--hub-text-bright);
    --pico-h4-color: var(--hub-text-bright);
    --pico-muted-color: var(--hub-text-muted);
    --pico-muted-border-color: var(--hub-border);
    --pico-table-border-color: var(--hub-border-subtle);
    --pico-code-background-color: rgba(8, 145, 178, 0.08);
    --pico-code-color: var(--hub-accent);
}

/* --- Base typography --- */
body {
    font-family: var(--hub-font-body);
    background: var(--hub-bg-deep);
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--hub-font-mono);
    font-weight: 600;
    letter-spacing: -0.03em;
}

code, kbd, pre {
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
}

/* --- Nav bar --- */
nav {
    background: var(--hub-bg) !important;
    border-bottom: 1px solid var(--hub-border);
    backdrop-filter: blur(0.75rem);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.5rem 1.5rem;
}

nav ul li strong {
    font-family: var(--hub-font-mono);
    color: var(--hub-accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.85em;
}

nav a[aria-current="page"] {
    color: var(--hub-accent) !important;
    position: relative;
}

nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 0.125rem;
    background: var(--hub-accent);
    border-radius: 0.0625rem;
}

nav button.outline {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
    border-color: var(--hub-border);
    background: transparent;
    color: var(--hub-text);
}

nav a svg {
    color: var(--hub-text);
}

nav button.outline:hover {
    border-color: var(--hub-accent);
    background: var(--hub-accent-dim);
}

/* --- Main container --- */
main.container {
    max-width: 87.5rem;
    padding-top: 2rem;
}

/* --- Site footer --- */
.site-footer {
    text-align: center;
    padding: 2rem 0 1rem;
    font-size: 0.75rem;
    color: var(--hub-text-muted);
}
.site-footer a {
    color: var(--hub-text-muted);
    text-decoration: none;
}
.site-footer a:hover {
    color: var(--hub-accent);
}

/* --- Dashboard actions --- */
.dashboard-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.dashboard-action-btn {
    font-size: 0.8em !important;
    padding: 0.3rem 0.75rem !important;
    border-color: var(--hub-border) !important;
    color: var(--hub-text-muted) !important;
    background: transparent !important;
}

.dashboard-action-btn:hover:not([disabled]) {
    border-color: var(--hub-accent) !important;
    color: var(--hub-accent) !important;
}

.dashboard-action-btn[disabled] {
    opacity: 0.3;
}

/* --- Repo page actions --- */
.repo-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.repo-action-btn {
    font-size: 0.85em !important;
    padding: 0.35rem 0.85rem !important;
    border-color: var(--hub-border) !important;
    color: var(--hub-text-muted) !important;
    background: transparent !important;
}

.repo-action-btn:hover {
    border-color: var(--hub-accent) !important;
    color: var(--hub-accent) !important;
}

.repo-action-danger:hover {
    border-color: var(--hub-danger) !important;
    color: var(--hub-danger) !important;
}

/* --- Repo split layout (pipelines + vulns side by side) --- */
.repo-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 60rem) {
    .repo-split {
        grid-template-columns: 1fr;
    }
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.section-header h3 {
    margin-bottom: 0.5rem;
}

.section-link {
    font-size: 0.8em;
    color: var(--hub-text-muted);
    text-decoration: none;
}

.section-note {
    font-size: 0.75em;
    color: var(--hub-text-muted);
    opacity: 0.7;
}

.section-link:hover {
    color: var(--hub-accent);
}

/* --- Cards --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr));
    gap: 1rem;
}

.card-grid article {
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    padding: 0.675rem 0.75rem;
    cursor: pointer;
    transition: all var(--hub-transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-grid article::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--hub-accent-dim) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--hub-transition);
}

.card-grid article:hover {
    border-color: var(--hub-accent);
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.3), 0 0 0 1px var(--hub-accent-dim);
}

.card-grid article:hover::before {
    opacity: 1;
}

.card-grid article.pinned {
    border-left: 0.1875rem solid var(--hub-accent);
    background: linear-gradient(135deg, var(--hub-accent-dim) 0%, var(--hub-bg-card) 30%);
}

.card-grid article header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -0.675rem -0.75rem 0.25rem;
    padding: 0.425rem 0.675rem;
    border: none;
    border-radius: var(--hub-radius) var(--hub-radius) 0 0;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
    gap: 0.35rem;
    min-width: 0;
}

.card-grid article header a {
    font-family: var(--hub-font-mono);
    font-size: 0.95em;
    color: var(--hub-text-bright);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.card-grid article header a:hover {
    color: var(--hub-accent);
}

.card-grid article p,
.card-grid article small,
.card-grid article footer,
.card-grid article .card-body,
.card-grid article .card-stats {
    position: relative;
    z-index: 1;
}

/* Card inner layout */
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-branch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-branch code {
    font-size: 0.8em;
}

.card-sync {
    font-family: var(--hub-font-mono);
    font-size: 0.8em;
    display: flex;
    gap: 0.35rem;
}

.card-default-branch {
    font-family: var(--hub-font-mono);
    font-size: 0.75em;
    color: var(--hub-text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-default-branch code {
    font-size: 1em;
    color: var(--hub-text-muted);
}

.card-muted {
    font-size: 0.75em;
    color: var(--hub-text-muted);
    opacity: 0.45;
}

.card-middle {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 2.25em;
}

.card-middle-center {
    flex: 1;
    justify-content: center;
}

.card-pull-status {
    font-size: 0.8em;
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.25rem;
    margin-top: 0.1rem;
    border-top: 1px solid var(--hub-border-subtle);
}

.card-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8em;
}

.card-stat-value {
    font-family: var(--hub-font-mono);
    font-weight: 600;
    color: var(--hub-text-bright);
}

.card-stat-label {
    color: var(--hub-text-muted);
    font-size: 0.9em;
}

.pin-btn {
    padding: 0.15rem 0.3rem !important;
    font-size: 0.8rem !important;
    border: none !important;
    background: transparent !important;
    color: var(--hub-text-muted) !important;
    opacity: 0.5;
    transition: opacity var(--hub-transition);
}

.pin-btn:hover {
    opacity: 1;
}

/* --- Severity badges --- */
[class^="badge-"] {
    display: inline-block;
    padding: 0.15em 0.6em;
    border-radius: 99rem;
    font-size: 0.75em;
    font-weight: 600;
    font-family: var(--hub-font-mono);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.6;
}

.badge-critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--hub-severity-critical);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-high {
    background: rgba(249, 115, 22, 0.15);
    color: var(--hub-severity-high);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-medium {
    background: rgba(234, 179, 8, 0.15);
    color: var(--hub-severity-medium);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge-low {
    background: rgba(107, 114, 128, 0.15);
    color: var(--hub-severity-low);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-stale {
    background: rgba(251, 191, 36, 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-diverged {
    background: rgba(96, 165, 250, 0.15);
    color: var(--hub-info);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-fixed {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

tr.vuln-fixed {
    opacity: 0.5;
}

/* Event type badges */
.badge-pipeline_failed {
    background: rgba(248, 113, 113, 0.15);
    color: var(--hub-danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.badge-pipeline_fixed {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-mr_new_comment {
    background: rgba(96, 165, 250, 0.15);
    color: var(--hub-info);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-mr_approved {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-mr_changes_requested {
    background: rgba(251, 191, 36, 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-mr_merged {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-vuln_new {
    background: rgba(239, 68, 68, 0.15);
    color: var(--hub-severity-critical);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-vuln_resolved {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-branch_stale {
    background: rgba(251, 191, 36, 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-branch_diverged {
    background: rgba(96, 165, 250, 0.15);
    color: var(--hub-info);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-auth_expired {
    background: rgba(248, 113, 113, 0.15);
    color: var(--hub-danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* --- Pipeline status dots --- */
.dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    position: relative;
}

.dot-success {
    background: var(--hub-success);
    box-shadow: 0 0 0.375rem var(--hub-success);
}

.dot-failed {
    background: var(--hub-danger);
    box-shadow: 0 0 0.375rem var(--hub-danger);
    animation: pulse-dot 2s infinite;
}

.dot-running {
    background: var(--hub-warning);
    box-shadow: 0 0 0.375rem var(--hub-warning);
    animation: pulse-dot 1.5s infinite;
}

.dot-pending {
    background: var(--hub-severity-low);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Pull status --- */
.pull-clean {
    color: var(--hub-success);
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
}

.pull-conflict {
    color: var(--hub-danger);
    font-weight: 600;
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
}

/* --- Tables --- */
table {
    border-collapse: separate;
    border-spacing: 0;
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    overflow: hidden;
    font-size: 0.9em;
}

thead th {
    font-family: var(--hub-font-mono);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hub-text-muted);
    background: var(--hub-bg-raised);
    border-bottom: 1px solid var(--hub-border);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--hub-border-subtle);
    max-width: 18.75rem;
}

tbody td code {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr {
    transition: background var(--hub-transition);
}

tbody tr:hover {
    background: var(--hub-accent-dim);
}

/* Mine highlight */
.row-mine {
    border-left: 0.1875rem solid var(--hub-accent);
    background: var(--hub-accent-dim);
}

.row-mine:hover {
    background: var(--hub-accent-glow) !important;
}

/* --- Events panel --- */
.events-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 23.75rem;
    background: var(--hub-bg);
    border-left: 1px solid var(--hub-border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    overflow-y: auto;
    padding: 1.5rem;
    backdrop-filter: blur(1rem);
}

.events-panel[data-open="true"] {
    transform: translateX(0);
    box-shadow: -0.5rem 0 2rem rgba(0, 0, 0, 0.4);
}

.events-panel header {
    position: sticky;
    top: 0;
    background: var(--hub-bg);
    border-bottom: 1px solid var(--hub-border);
    padding-bottom: 1rem;
    margin: -1.5rem -1.5rem 1rem;
    padding: 1.5rem 1.5rem 1rem;
    z-index: 1;
}

.events-panel h4 {
    font-family: var(--hub-font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85em;
    color: var(--hub-text-muted);
    margin: 0;
}

.events-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(0.25rem);
    z-index: 99;
}

.events-overlay:not([data-open="true"]) {
    display: none;
}

.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.event-item {
    padding: 0.75rem;
    border: 1px solid var(--hub-border-subtle);
    border-radius: var(--hub-radius-sm);
    margin-bottom: 0.5rem;
    background: var(--hub-bg-raised);
    transition: border-color var(--hub-transition);
    position: relative;
}

.event-item:hover {
    border-color: var(--hub-border);
}

.event-item p {
    margin: 0.25rem 0;
    font-size: 0.9em;
    color: var(--hub-text);
}

.event-item small {
    color: var(--hub-text-muted);
    font-size: 0.8em;
    font-family: var(--hub-font-mono);
}

.event-item button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.1rem 0.3rem !important;
    font-size: 0.7rem !important;
    opacity: 0;
    transition: opacity var(--hub-transition);
}

.event-item:hover button {
    opacity: 1;
}

/* --- Toast zone --- */
.toast-zone {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1.25rem;
    border-radius: var(--hub-radius);
    cursor: pointer;
    max-width: 23.75rem;
    font-size: 0.9em;
    font-family: var(--hub-font-body);
    backdrop-filter: blur(0.5rem);
    border: 1px solid transparent;
}

.toast-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border-color: rgba(52, 211, 153, 0.3);
}

.toast-error {
    background: rgba(248, 113, 113, 0.15);
    color: var(--hub-danger);
    border-color: rgba(248, 113, 113, 0.3);
}

.toast-info {
    background: var(--hub-accent-dim);
    color: var(--hub-accent);
    border-color: rgba(34, 211, 238, 0.3);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(1rem) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Badge on bell --- */
#events-bell {
    position: relative;
}

#events-bell .badge {
    position: absolute;
    top: -0.375rem;
    right: -0.375rem;
    background: var(--hub-danger);
    color: white;
    border-radius: 99rem;
    font-size: 0.625rem;
    font-weight: 700;
    font-family: var(--hub-font-mono);
    line-height: 1;
    padding: 0.1875rem 0.3125rem;
    min-width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 0 0 0.125rem var(--hub-bg);
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* --- Breadcrumb --- */
.breadcrumb {
    list-style: none;
    display: flex;
    gap: 0.5em;
    padding: 0;
    margin-bottom: 1.5rem;
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
}
.breadcrumb li {
    list-style: none;
    padding-left: 0;
}

.breadcrumb li::before {
    content: "/";
    margin-right: 0.5em;
    color: var(--hub-text-muted);
}

.breadcrumb li:first-child::before {
    content: "";
    margin: 0;
}

.breadcrumb a {
    color: var(--hub-text-muted);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--hub-accent);
}

/* --- Filter toggle --- */
.filter-toggle {
    margin-bottom: 1rem;
    display: inline-flex;
    width: auto;
}

.filter-toggle button {
    flex: none;
    font-family: var(--hub-font-mono);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-toggle button.filter-active {
    background: var(--hub-accent);
    border-color: var(--hub-accent);
    color: var(--hub-bg);
    font-weight: 600;
}

.filter-toggle button:not(.filter-active) {
    opacity: 0.6;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--hub-font-mono);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

.filter-chip input[type="checkbox"] {
    margin: 0;
    width: 1em;
    height: 1em;
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-sep {
    display: inline-block;
    width: 0.0625rem;
    height: 1.2em;
    background: var(--hub-border);
    margin: 0 0.25rem;
    vertical-align: middle;
}

.vulns-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-sev {
    font-family: var(--hub-font-mono);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-sev[data-sev="critical"].filter-active {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--hub-severity-critical);
    color: var(--hub-severity-critical);
}

.filter-sev[data-sev="high"].filter-active {
    background: rgba(249, 115, 22, 0.15);
    border-color: var(--hub-severity-high);
    color: var(--hub-severity-high);
}

.filter-sev[data-sev="medium"].filter-active {
    background: rgba(234, 179, 8, 0.15);
    border-color: var(--hub-severity-medium);
    color: var(--hub-severity-medium);
}

.filter-sev[data-sev="low"].filter-active {
    background: rgba(107, 114, 128, 0.15);
    border-color: var(--hub-severity-low);
    color: var(--hub-severity-low);
}

/* --- Stats bar --- */
.stats-bar {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    background: var(--hub-bg-card);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    font-family: var(--hub-font-mono);
    font-size: 0.8em;
}

.stat-chip-value {
    font-weight: 700;
    color: var(--hub-text-bright);
}

.stat-chip-label {
    color: var(--hub-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85em;
}

.stat-chip-accent { border-color: var(--hub-accent); }
.stat-chip-accent .stat-chip-value { color: var(--hub-accent); }

.stat-chip-success { border-color: var(--hub-success); }
.stat-chip-success .stat-chip-value { color: var(--hub-success); }

.stat-chip-danger { border-color: var(--hub-danger); }
.stat-chip-danger .stat-chip-value { color: var(--hub-danger); }

.stat-chip-warning { border-color: var(--hub-warning); }
.stat-chip-warning .stat-chip-value { color: var(--hub-warning); }

.stat-chip-info { border-color: var(--hub-info); }
.stat-chip-info .stat-chip-value { color: var(--hub-info); }

/* --- MR/table inline elements --- */
.mr-iid {
    color: var(--hub-text-muted);
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
    margin-left: 0.35rem;
}

.branch-cell {
    white-space: nowrap;
    max-width: 22rem;
}
.branch-cell code {
    display: inline-block;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.branch-arrow {
    color: var(--hub-text-muted);
    margin: 0 0.15rem;
}

td.info-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: none;
    overflow: visible;
}

.comment-count, .approved-check {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-family: var(--hub-font-mono);
    font-size: 0.85em;
}

.comment-count {
    color: var(--hub-text-muted);
}

.approved-check {
    color: var(--hub-success);
}

.inline-icon {
    width: 0.9em;
    height: 0.9em;
    vertical-align: middle;
}

/* --- MR state badges --- */
.badge-opened {
    background: rgba(96, 165, 250, 0.15);
    color: var(--hub-info);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge-approved {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-merged {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-closed {
    background: rgba(107, 114, 128, 0.15);
    color: var(--hub-severity-low);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* --- Vuln state badges --- */
.badge-detected, .badge-confirmed {
    background: rgba(251, 191, 36, 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-resolved, .badge-dismissed {
    background: rgba(107, 114, 128, 0.15);
    color: var(--hub-severity-low);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* --- Pipeline status badges --- */
.badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--hub-success);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-failed {
    background: rgba(248, 113, 113, 0.15);
    color: var(--hub-danger);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.badge-running {
    background: rgba(251, 191, 36, 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-pending, .badge-created {
    background: rgba(107, 114, 128, 0.15);
    color: var(--hub-severity-low);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.badge-canceled, .badge-skipped {
    background: rgba(107, 114, 128, 0.1);
    color: var(--hub-text-muted);
    border: 1px solid rgba(107, 114, 128, 0.2);
}

/* --- Headings --- */
h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--hub-text-bright);
}

h3 {
    font-size: 1.1rem;
    color: var(--hub-text-bright);
    margin-top: 2rem;
}

h5 {
    font-family: var(--hub-font-mono);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hub-text-muted);
    margin-bottom: 0.75rem;
}

/* --- Buttons (Pico overrides) --- */
button, [type="submit"] {
    font-family: var(--hub-font-body);
    font-size: 0.9em;
    border-radius: var(--hub-radius-sm);
}

button.outline:not(:hover) {
    border-color: var(--hub-border);
}

/* --- Code blocks --- */
code {
    background: var(--hub-accent-dim);
    color: var(--hub-accent);
    border-radius: var(--hub-radius-sm);
    padding: 0.1em 0.35em;
    font-size: 0.85em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--hub-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--hub-text-muted);
}

/* --- Hidden utility --- */
.hidden {
    display: none !important;
}

/* --- Drag ghost --- */
.sortable-ghost {
    opacity: 0.3;
    border: 0.125rem dashed var(--hub-accent) !important;
}

/* --- Sync button states --- */
button[aria-busy="true"] {
    color: var(--hub-accent) !important;
    border-color: var(--hub-accent) !important;
}

/* --- Section spacing for repo detail --- */
section + section {
    margin-top: 1rem;
}

/* --- Loading animation override --- */
[aria-busy="true"]::before {
    border-color: var(--hub-accent) transparent var(--hub-accent) transparent !important;
}

/* --- Tablesort theme integration --- */
table.sortable {
    --stripe-color: var(--hub-bg-raised);
    --th-color: var(--hub-text-muted);
    --th-bg: var(--hub-bg-raised);
    --td-color: var(--hub-text);
    --td-on-stripe-color: var(--hub-text);
}

/* --- Utility classes (replaces inline styles) --- */
.text-center-muted {
    text-align: center;
    color: var(--hub-text-muted);
}

.text-dismissed {
    text-align: center;
    color: var(--hub-text-muted);
}

.loading-container {
    text-align: center;
    padding: 3rem;
}

.toast-animate {
    animation: toast-in 0.3s ease;
}

.event-type-label {
    font-size: 0.8em;
}

/* --- Nav icon buttons --- */
.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

/* Theme toggle: show sun in dark mode, moon in light mode */
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-flex; }

.pin-btn .nav-icon {
    width: 0.85em;
    height: 0.85em;
}

/* Vulns table: allow wrapping, no ellipsis truncation */
.vulns-table td {
    max-width: none;
}

.vulns-table td code {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
}

.vulns-table .nowrap code {
    white-space: nowrap;
}

.vulns-table .break-url code {
    word-break: break-all;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .events-panel {
        width: 100%;
    }

    .toast {
        max-width: calc(100vw - 3rem);
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .events-panel {
        width: min(23.75rem, 100%);
    }
}
