/* ── Reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: #1a1a1a;
    background: #fff;
}

a { color: #0059c8; }
a:hover { text-decoration: none; }

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
    background: #0059c8;
    color: #fff;
}
nav {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-home {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
}
.nav-home:hover { color: #fff; }
.nav-sep { color: rgba(255, 255, 255, 0.45); font-size: 16px; }
.nav-current { color: #fff; font-weight: 500; }
.nav-back {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.3);
    transition: background 0.15s;
}
.nav-back:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Main content ─────────────────────────────────────────────────────────── */
main {
    max-width: 920px;
    margin: 0 auto;
    padding: 36px 24px 80px;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 14px;
    color: #111;
}
h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ebebeb;
    color: #111;
}
.blurb {
    color: #555;
    margin: 0 0 28px;
    max-width: 700px;
}

/* ── Status bar ───────────────────────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.muted { color: #999; font-size: 13px; }
.btn-ghost {
    background: none;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    transition: background 0.1s, border-color 0.1s;
}
.btn-ghost:hover { background: #f5f5f5; border-color: #bbb; }

/* ── Sources section ──────────────────────────────────────────────────────── */
.sources-section { margin-bottom: 56px; }

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.sources-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    background: #fafafa;
    border-bottom: 1px solid #e8e8e8;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
.sources-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.sources-table tbody tr.source-row { cursor: pointer; }
.sources-table tbody tr.source-row:hover td { background: #f7f9ff; }
.sources-table tbody tr.source-row:last-of-type td { border-bottom: none; }

/* ── Source name cell ─────────────────────────────────────────────────────── */
.source-name { font-weight: 500; color: #1a1a1a; }
.source-id {
    font-size: 11px;
    color: #aaa;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    margin-top: 2px;
}
.expand-arrow {
    display: inline-block;
    transition: transform 0.15s;
    color: #bbb;
    font-size: 13px;
    margin-right: 6px;
    vertical-align: middle;
    line-height: 1;
}
.row-expanded .expand-arrow { transform: rotate(90deg); }

/* ── Status badge ─────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge--success { background: #dcfce7; color: #166534; }
.badge--skipped { background: #fef9c3; color: #854d0e; }
.badge--failed  { background: #fee2e2; color: #991b1b; }
.badge--pending { background: #f0f0f0; color: #aaa; }

/* ── Expandable detail row ────────────────────────────────────────────────── */
tr.detail-row td {
    padding: 0;
    background: #f7f9fc;
    cursor: default;
    border-bottom: 2px solid #e4eaf4;
}
tr.detail-row.hidden { display: none; }

.detail-inner {
    padding: 18px 20px 20px 44px;
}
.detail-inner p {
    margin: 0 0 8px;
    color: #444;
    font-size: 13px;
    line-height: 1.6;
}
.detail-inner p:last-child { margin-bottom: 0; }
.detail-uses { color: #555; }
.detail-uses strong { color: #333; }
.detail-publisher-link { font-size: 12px; }
.detail-publisher-link a { color: #0059c8; }

.detail-error {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fee2e2;
    border-radius: 4px;
    font-size: 12px;
    color: #991b1b;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    word-break: break-all;
}

/* ── Glossary section ─────────────────────────────────────────────────────── */
.glossary-section { margin-top: 8px; }

.glossary-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 24px;
    font-size: 13px;
    line-height: 1.6;
}
.glossary-list dt {
    font-weight: 700;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #0059c8;
    padding-top: 2px;
    white-space: nowrap;
}
.glossary-list dd {
    margin: 0;
    color: #444;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid #ebebeb;
    padding: 24px;
    text-align: center;
    font-size: 12px;
    color: #aaa;
}
footer a { color: #aaa; }
footer a:hover { color: #555; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    main { padding: 24px 16px 60px; }
    h1 { font-size: 22px; }
    .sources-table th:nth-child(3),
    .sources-table td:nth-child(3),
    .sources-table th:nth-child(5),
    .sources-table td:nth-child(5),
    .sources-table th:nth-child(6),
    .sources-table td:nth-child(6) {
        display: none;
    }
    .detail-inner { padding: 14px 16px; }
    .glossary-list { grid-template-columns: 1fr; }
    .glossary-list dt { padding-top: 8px; }
}
