/* ---------- S&P Global brand palette ---------- */
:root {
    --spg-red:        #E01030;   /* S&P Global primary red */
    --spg-red-dark:   #A30D24;   /* hover / pressed */
    --spg-navy:       #1A1A2E;   /* deep navy / near-black */
    --spg-navy-2:     #2B2B45;   /* slightly lighter navy */
    --spg-charcoal:   #3F3F5A;
    --spg-bg:         #F4F5F7;   /* page background tint */
    --spg-surface:    #FFFFFF;
    --spg-border:     #E3E5EA;
    --spg-text:       #1A1A2E;
    --spg-muted:      #5C6273;

    --ok-bg:    #E6F4EA;  --ok-fg:    #1E7E34;
    --warn-bg:  #FFF4E0;  --warn-fg:  #B96A00;
    --bad-bg:   #FDE8EC;  --bad-fg:   #B00020;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--spg-bg);
    color: var(--spg-text);
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: var(--spg-surface);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(26, 26, 46, 0.18);
    overflow: hidden;
    border-top: 4px solid var(--spg-red);
}

/* On wide screens, let the dashboard use the full viewport width
   (minus the body padding) so the data table has room to breathe
   instead of squashing 9 columns into ~1340px. */
@media (min-width: 1500px) {
    .container { max-width: calc(100vw - 40px); }
}

/* ---------- Header ---------- */
header {
    background: linear-gradient(135deg, var(--spg-navy) 0%, var(--spg-navy-2) 100%);
    color: white;
    padding: 28px 40px;
    display: flex;
    align-items: center;
    gap: 28px;
    position: relative;
}

header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 3px;
    background: var(--spg-red);
}

.brand-logo {
    height: 56px;
    width: auto;
    flex-shrink: 0;
}

/* When the logo is wrapped in an anchor (e.g. on stats.html, where it
   acts as a "back to home" shortcut), strip default link decoration
   and give a subtle hover/focus affordance so users discover it. */
.brand-logo-link {
    display: inline-flex;
    flex-shrink: 0;
    text-decoration: none;
    border-radius: 4px;
    transition: opacity 0.15s, transform 0.05s;
}
.brand-logo-link:hover { opacity: 0.85; }
.brand-logo-link:active { transform: translateY(1px); }
.brand-logo-link:focus-visible {
    outline: 2px solid var(--spg-red);
    outline-offset: 3px;
}

.header-text { flex: 1; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: var(--spg-red);
    color: #fff;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.15s, transform 0.05s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.download-btn:hover { background: var(--spg-red-dark); }
.download-btn:active { transform: translateY(1px); }

.download-btn[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

/* Secondary "this run" button – outline style so the primary CTA still leads. */
.download-btn-secondary {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    box-shadow: none;
}
.download-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: #fff;
}

h1 {
    font-size: 1.9em;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.subtitle {
    font-size: 0.95em;
    opacity: 0.8;
    margin-top: 4px;
}

/* ---------- Last updated banner ---------- */
.last-updated {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 30px;
    background: #FFF6F8;                /* very light tint of S&P red */
    border-bottom: 1px solid var(--spg-border);
    border-left: 4px solid var(--spg-red);
    font-size: 0.95em;
    color: var(--spg-text);
}

.last-updated-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.78em;
    color: var(--spg-red);
}

.last-updated-value { font-weight: 600; }

.last-updated-relative {
    color: var(--spg-muted);
    font-size: 0.9em;
}

/* ---------- Summary cards ---------- */
.stats-summary {
    display: flex;
    justify-content: space-around;
    padding: 28px;
    background: var(--spg-bg);
    border-bottom: 1px solid var(--spg-border);
    flex-wrap: wrap;
    gap: 15px;
}

.stat-card {
    text-align: center;
    padding: 20px 24px;
    background: var(--spg-surface);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(26, 26, 46, 0.08);
    min-width: 160px;
    border-top: 3px solid var(--spg-red);
}

.stat-number {
    font-size: 2.4em;
    font-weight: 700;
    color: var(--spg-navy);
    display: block;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.8em;
    color: var(--spg-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ---------- Search + filters ---------- */
.search-container {
    padding: 18px 30px;
    background: var(--spg-surface);
    border-bottom: 1px solid var(--spg-border);
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1 1 320px;
    min-width: 240px;
    padding: 12px 18px;
    font-size: 16px;
    border: 2px solid var(--spg-border);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--spg-surface);
    color: var(--spg-text);
}

.search-box:focus {
    outline: none;
    border-color: var(--spg-red);
    box-shadow: 0 0 0 3px rgba(224, 16, 48, 0.12);
}

.filter-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--spg-muted);
    white-space: nowrap;
}

.filter-label {
    font-weight: 600;
}

.filter-select {
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid var(--spg-border);
    border-radius: 6px;
    background: var(--spg-surface);
    color: var(--spg-text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--spg-red);
    box-shadow: 0 0 0 3px rgba(224, 16, 48, 0.12);
}

.language-filter-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--spg-muted);
    white-space: nowrap;
}

.language-filter-wrapper .filter-label {
    font-weight: 600;
}

.language-dropdown {
    position: relative;
    display: inline-block;
}

.language-dropdown-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    min-height: 42px;
    min-width: 150px;
    font-size: 14px;
    border: 2px solid var(--spg-border);
    border-radius: 6px;
    background: var(--spg-surface);
    color: var(--spg-text);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-weight: 500;
}

.language-dropdown-button:hover,
.language-dropdown-button:focus {
    outline: none;
    border-color: var(--spg-red);
}

.language-dropdown-button:focus {
    box-shadow: 0 0 0 3px rgba(224, 16, 48, 0.12);
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

.language-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--spg-surface);
    border: 2px solid var(--spg-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.15);
    z-index: 1000;
    width: min(360px, calc(100vw - 24px));
    max-height: min(420px, calc(100vh - 180px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.language-dropdown-search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--spg-border);
    background: var(--spg-bg);
}

.language-dropdown-search {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--spg-border);
    border-radius: 4px;
    font-size: 13px;
    color: var(--spg-text);
    background: var(--spg-surface);
}

.language-dropdown-search:focus {
    outline: none;
    border-color: var(--spg-red);
    box-shadow: 0 0 0 2px rgba(224, 16, 48, 0.12);
}

.language-dropdown-options {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--spg-border) transparent;
}

.language-dropdown-options::-webkit-scrollbar {
    width: 10px;
}

.language-dropdown-options::-webkit-scrollbar-thumb {
    background: var(--spg-border);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.language-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.language-no-results {
    padding: 10px;
    font-size: 13px;
    color: var(--spg-muted);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    user-select: none;
    font-size: 13px;
    color: var(--spg-text);
}

.language-option:hover {
    background: var(--spg-bg);
}

.language-option input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
    accent-color: var(--spg-red);
}

.language-dropdown-footer {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--spg-border);
    background: var(--spg-bg);
    border-radius: 0 0 4px 4px;
}

.clear-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--spg-red);
    background: transparent;
    border: 1.5px solid var(--spg-red);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.clear-filter-btn:hover {
    background: var(--spg-red);
    color: #fff;
}

.clear-filter-btn:disabled,
.clear-filter-btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

.clear-filter-btn:disabled:hover,
.clear-filter-btn[aria-disabled="true"]:hover {
    background: transparent;
    color: var(--spg-red);
}

.filter-input {
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid var(--spg-border);
    border-radius: 6px;
    background: var(--spg-surface);
    color: var(--spg-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.filter-input::placeholder {
    color: var(--spg-muted);
}

.filter-input:focus {
    outline: none;
    border-color: var(--spg-red);
    box-shadow: 0 0 0 3px rgba(224, 16, 48, 0.12);
}

/* ---------- Archived rows ---------- */
.archived-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--spg-muted);
    border-radius: 10px;
    vertical-align: middle;
}

.row-archived {
    background: rgba(0, 0, 0, 0.025);
}

.row-archived td.repo-name {
    color: var(--spg-muted);
    font-style: italic;
}

/* ---------- Table ---------- */
.table-container { overflow-x: auto; padding: 24px 30px 30px; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--spg-surface);
    /* `fixed` is required for column resizing to work predictably:
       cell content no longer overrides the <col> widths set by the
       resizer. Long content wraps via overflow-wrap rules below. */
    table-layout: fixed;
    min-width: 980px;
}

/* Per-column hints. The browser is free to grow columns past these,
   but they prevent any single column from collapsing to nothing
   when the page is busy. Order matches the <thead> in stats.html.
   The dedicated URL column was folded into the name column — its width
   is reallocated to the name (now also the link target). */
#repoTable col.col-name      { width: 24%; min-width: 220px; }
#repoTable col.col-size      { width: 80px; }
#repoTable col.col-branches  { width: 90px; }
#repoTable col.col-prs       { width: 90px; }
#repoTable col.col-created   { width: 110px; }
#repoTable col.col-commit    { width: 110px; }
#repoTable col.col-languages { width: 12%; min-width: 160px; }
#repoTable col.col-props     { width: 14%; min-width: 180px; }
#repoTable col.col-contacts  { width: 18%; min-width: 200px; }

thead {
    background: var(--spg-navy);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    user-select: none;
    border-bottom: 3px solid var(--spg-red);
    white-space: nowrap;
    /* Anchor for the absolutely-positioned column resizer handle. */
    position: relative;
}

/* ---------- Column resizer handle ----------
   A thin grab strip on the right edge of every <th>. Click + drag
   adjusts the matching <col> width; double-click resets that column
   to its default. Widths persist in localStorage per-org. */
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    /* Hidden visual until hover/drag — keeps the header clean. */
    background: transparent;
    z-index: 11;
    touch-action: none;
}
.col-resizer::after {
    content: "";
    position: absolute;
    top: 25%;
    right: 3px;
    width: 2px;
    height: 50%;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 1px;
    transition: background-color 0.15s;
}
.col-resizer:hover::after,
.col-resizer.is-dragging::after {
    background: var(--spg-red);
}
/* Suppress sort-toggle while a drag is happening. */
body.col-resizing,
body.col-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}
body.col-resizing #repoTable thead th { background: var(--spg-navy); }

th:hover { background: var(--spg-navy-2); }
th::after { content: ' ↕'; opacity: 0.55; font-size: 0.85em; }

tbody tr {
    border-bottom: 1px solid var(--spg-border);
    transition: background-color 0.15s;
}
tbody tr:hover { background-color: rgba(224, 16, 48, 0.04); }
tbody tr.hidden { display: none; }

td {
    padding: 12px 12px;
    font-size: 0.92em;
    color: var(--spg-text);
    vertical-align: top;
    /* Allow long unbroken tokens (e.g. URL slugs) to wrap instead of
       forcing the whole column wider. */
    overflow-wrap: anywhere;
}

.repo-name {
    font-weight: 600;
    color: var(--spg-navy);
    overflow-wrap: anywhere;
}

.repo-url {
    color: var(--spg-red);
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s;
    /* Wrap at sensible boundaries (slashes, hyphens) instead of every
       character — keeps the URL readable while still respecting the
       column width. */
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.88em;
    line-height: 1.35;
}
.repo-url:hover { color: var(--spg-red-dark); text-decoration: underline; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-align: center;
    min-width: 40px;
}

.badge-success { background: var(--ok-bg);   color: var(--ok-fg); }
.badge-warning { background: var(--warn-bg); color: var(--warn-fg); }
.badge-danger  { background: var(--bad-bg);  color: var(--bad-fg); }

/* ---------- Contacts column ---------- */
.contact-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.3;
}

.contact-name {
    font-weight: 600;
    color: var(--spg-navy);
    font-size: 0.92em;
}

.contact-link {
    font-weight: 600;
    color: var(--spg-navy);
    font-size: 0.92em;
    text-decoration: none;
    border-bottom: 1px dotted transparent;
    transition: color 0.15s, border-color 0.15s;
}

.contact-link:hover {
    color: var(--spg-red);
    border-bottom-color: var(--spg-red);
}

.contact-source {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Source chip variants */
.contact-source-admin {
    background: rgba(224, 16, 48, 0.10);
    color: var(--spg-red-dark);
}
.contact-source-admin-team {
    background: rgba(26, 26, 46, 0.10);
    color: var(--spg-navy);
}
.contact-source-write-maintainer {
    background: rgba(245, 124, 0, 0.12);
    color: #B96A00;
}
.contact-source-write-team {
    background: rgba(63, 63, 90, 0.10);
    color: var(--spg-charcoal);
}
.contact-source-team-name {
    background: rgba(25, 118, 210, 0.10);
    color: #1565C0;
}
.contact-source-creator {
    background: rgba(102, 51, 153, 0.10);
    color: #6A1B9A;
}

.contacts-empty {
    color: var(--spg-muted);
    font-style: italic;
}

/* ---------- Misc ---------- */
.status {
    padding: 40px;
    text-align: center;
    color: var(--spg-muted);
    font-size: 1.05em;
}
.status.error { color: var(--bad-fg); }

footer {
    text-align: center;
    padding: 18px;
    color: var(--spg-muted);
    font-size: 0.85em;
    background: var(--spg-bg);
    border-top: 1px solid var(--spg-border);
}

/* ---------- Site navigation toolbar ---------- */
.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    background: var(--spg-surface);
    border-bottom: 1px solid var(--spg-border);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--spg-text);
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.nav-btn:hover,
.nav-btn:focus-visible {
    border-color: var(--spg-red);
    color: var(--spg-red);
    outline: none;
}

.nav-btn-icon {
    padding: 8px 12px;
    font-size: 16px;
}

.nav-btn-active,
.nav-btn-active:hover {
    background: var(--spg-navy);
    color: #fff;
    border-color: var(--spg-navy);
    cursor: default;
}

.nav-btn-secondary {
    margin-left: auto; /* push to the right edge of the toolbar */
}

.nav-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    border-radius: 6px;
}

.nav-control-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--spg-muted);
}

.nav-select {
    padding: 4px 6px;
    font-size: 14px;
    border: none;
    background: transparent;
    color: var(--spg-text);
    cursor: pointer;
}

.nav-select:focus {
    outline: none;
}

/* ---------- Landing page ---------- */
.landing-intro {
    padding: 28px 30px;
    border-bottom: 1px solid var(--spg-border);
}

.landing-intro h2 {
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--spg-red);
    margin-top: 18px;
    margin-bottom: 8px;
}
.landing-intro h2:first-child { margin-top: 0; }

.landing-intro p,
.landing-intro li {
    font-size: 0.95em;
    line-height: 1.55;
    color: var(--spg-text);
}

.landing-intro ul.landing-options {
    margin: 0 0 4px 1.2em;
    padding: 0;
}
.landing-intro ul.landing-options li {
    margin: 4px 0;
}

.landing-intro code,
.landing-code {
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    color: var(--spg-navy);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}
.landing-code {
    display: block;
    padding: 12px 16px;
    margin: 8px 0 4px;
    overflow-x: auto;
}

.landing-orgs {
    padding: 24px 30px 30px;
}

.landing-orgs-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}

.landing-orgs-header h2 {
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--spg-red);
    margin: 0;
}

.landing-orgs-meta {
    font-size: 0.82em;
    color: var(--spg-muted);
}

.org-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* `1fr` forces every row to share the height of the tallest card,
       and `align-items: stretch` (grid default) makes every card fill
       its cell — together that means every card on the page is the
       same size regardless of how much history each org has. */
    grid-auto-rows: 1fr;
    gap: 18px;
}

.org-card {
    background: var(--spg-surface);
    border: 1px solid var(--spg-border);
    border-top: 3px solid var(--spg-red);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 2px 6px rgba(26, 26, 46, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;     /* horizontally centre every section */
    text-align: center;
    gap: 12px;
    height: 100%;            /* fill the grid cell so all cards match */
    overflow: hidden;        /* clip the strip's negative margin to the
                                rounded card corners */
}

.org-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    /* Dark "title strip" matching the dashboard table head. The org name
       and Dashboard link inside MUST be light to stay legible — see
       .org-card-header h3 and .org-card-latest. */
    background: var(--spg-navy);
    color: white;
    padding: 14px 16px;
    /* Pull the strip out so it spans the full width of the card. */
    margin: -18px -20px 4px;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.org-card-header h3 {
    margin: 0;
    font-size: 1.15em;
    color: var(--spg-red);   /* red title on the dark navy strip */
    word-break: break-word;
    text-align: center;
    width: 100%;
}

.org-card-latest {
    /* Sits inside the dark .org-card-header strip alongside the red title.
       Keep the link red too so the whole header reads as one unit. */
    color: var(--spg-red);
    font-weight: 700;
    font-size: 0.85em;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    line-height: 1.25;
    opacity: 0.95;
}
.org-card-latest:hover {
    color: var(--spg-red);
    opacity: 1;
    text-decoration: underline;
}

.org-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.org-card-link {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78em;
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    color: var(--spg-navy);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    word-break: break-all;
    max-width: 100%;
}
.org-card-link:hover {
    border-color: var(--spg-red);
    color: var(--spg-red);
}

.org-card-subhead {
    margin: 4px 0 0;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--spg-muted);
    font-weight: 700;
    text-align: center;
    width: 100%;
    /* Push the history block to the bottom so the top half of every
       card lines up regardless of how many date pills it has. */
    margin-top: auto;
}

.org-card-dates {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
}
.org-card-dates li { display: inline-block; }
.org-card-dates a {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(26, 26, 46, 0.05);
    color: var(--spg-navy);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.82em;
    font-weight: 600;
}
.org-card-dates a:hover {
    background: rgba(224, 16, 48, 0.10);
    color: var(--spg-red-dark);
}

.org-card-empty,
.org-card-more {
    color: var(--spg-muted);
    font-size: 0.82em;
    font-style: italic;
}

/* ---------- Pagination toolbar ----------
   Sits directly under the table. The auto-fit page-size mode is wired up
   so the table itself never causes the page to scroll vertically; this
   bar therefore stays just above the fold. */
.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-top: 12px;
    background: #fff;
    border: 1px solid var(--spg-border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--spg-text);
}

.page-btn {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--spg-navy);
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.page-btn:hover:not(:disabled),
.page-btn:focus-visible:not(:disabled) {
    border-color: var(--spg-red);
    color: var(--spg-red);
    outline: none;
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-info {
    flex: 1 1 auto;
    text-align: center;
    color: var(--spg-text);
    font-variant-numeric: tabular-nums;
}

.page-size-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.page-size-label {
    color: var(--spg-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.page-size-select {
    padding: 4px 6px;
    font-size: 13px;
    color: var(--spg-text);
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    border-radius: 4px;
}

/* ---------- Historical runs panel ----------
   Used by history.html (a standalone page). Re-uses the same dashboard
   chrome so the two views feel like one app. */
.history-section {
    padding: 24px 30px 30px;
    background: var(--spg-surface);
    border-top: 1px solid var(--spg-border);
}

.history-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.history-header h2 {
    font-size: 1.05em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--spg-red);
    margin: 0;
}

.history-meta {
    font-size: 0.85em;
    color: var(--spg-muted);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--spg-border);
    text-align: left;
    vertical-align: top;
}

.history-table thead {
    /* Reset the global `thead { background: navy; color: white }` rule
       (which is meant for the main repo table) so the history toolbar's
       header text isn't invisible muted-grey-on-navy. */
    background: var(--spg-bg);
    color: var(--spg-text);
}

.history-table thead th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--spg-navy);
    background: var(--spg-bg);
    border-bottom: 2px solid var(--spg-border);
    /* Override the main-table `cursor: pointer` (these headers don't sort). */
    cursor: default;
}
.history-table thead th::after {
    /* Suppress the `↕` sort indicator inherited from the main table styles. */
    content: none;
}
.history-table thead th:hover {
    background: var(--spg-bg);
}

.history-latest-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--spg-red);
    border-radius: 8px;
    vertical-align: middle;
}

.history-view-link {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--spg-navy);
    text-decoration: none;
    border-bottom: 1px dashed var(--spg-border);
}
.history-view-link:hover {
    color: var(--spg-red);
    border-bottom-color: var(--spg-red);
}

.history-url a {
    color: var(--spg-navy);
    text-decoration: none;
    word-break: break-all;
}
.history-url a:hover { color: var(--spg-red); }

.history-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Force the actions column to hug its buttons so the URL column gets
   the leftover space — and the three copy buttons always sit on one
   row instead of the PowerShell one wrapping below. The `text-align:
   center` lines the column header up over the centred button row. */
.history-table td.history-actions,
.history-table th.history-actions-col {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}

.history-actions .copy-btn {
    flex: 0 0 auto;
}

.history-empty {
    text-align: center;
    padding: 20px;
    color: var(--spg-muted);
}

/* ---------- Copy buttons ---------- */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--spg-navy);
    background: var(--spg-bg);
    border: 1px solid var(--spg-border);
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.copy-btn:hover,
.copy-btn:focus-visible {
    border-color: var(--spg-red);
    color: var(--spg-red);
    outline: none;
}

.copy-btn-done,
.copy-btn-done:hover {
    background: var(--ok-bg);
    border-color: var(--ok-fg);
    color: var(--ok-fg);
}

/* ---------- Pagination toolbar ---------- */
