:root {
    color: #17243a;
    background: #f5f7fa;
    font-family: system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    --ink: #17243a;
    --muted: #526179;
    --line: #dce3ed;
    --accent: #075c70;
    --accent-dark: #06485a;
    --surface: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent-dark); text-underline-offset: .18em; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #1369a0; outline-offset: 3px; }
.shell { width: min(1320px, 100% - 3rem); margin-inline: auto; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-content {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--ink);
    font-size: 1.19rem;
    font-weight: 760;
    text-decoration: none;
}
.brand-mark {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 7px;
    background: var(--accent);
    position: relative;
}
.brand-mark::after {
    content: "";
    position: absolute;
    inset: .3rem;
    background:
        linear-gradient(white, white) left bottom / 24% 36% no-repeat,
        linear-gradient(white, white) center bottom / 24% 67% no-repeat,
        linear-gradient(white, white) right bottom / 24% 100% no-repeat;
}
.topbar nav { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1.4rem; }
.topbar nav a { color: var(--ink); font-size: .88rem; font-weight: 650; text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }
.topbar nav a[aria-current="page"] { color: var(--accent-dark); text-decoration: underline; text-decoration-thickness: 2px; }

main { padding-block: clamp(1.5rem, 3.5vw, 3.2rem) 2rem; }
h1, h2, h3, p, dl { margin: 0; }
h1 {
    font-size: clamp(1.9rem, 4vw, 3.45rem);
    letter-spacing: -.055em;
    line-height: 1.1;
}
h2 { font-size: 1.27rem; letter-spacing: -.012em; }
h3 { font-size: 1.05rem; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-header > a { white-space: nowrap; font-size: .9rem; font-weight: 650; }
.summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.26fr);
    gap: .75rem;
    margin-bottom: 1rem;
}
.summary div { padding: .75rem 1.15rem .9rem; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary dt, .history-status dt { color: var(--muted); font-size: .81rem; font-weight: 630; }
.summary dd { margin: .12rem 0 0; font-size: clamp(1.65rem, 3vw, 2.6rem); line-height: 1.2; font-weight: 740; font-variant-numeric: tabular-nums; letter-spacing: -.045em; }
.summary .freshness { background: #152942; border-color: #152942; }
.freshness dt { color: #becde0; }
.freshness dd { margin-top: .45rem; color: #f4f7fe; font-size: .98rem; letter-spacing: 0; }

.layout { display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.statistics { align-items: stretch; margin-bottom: 1.25rem; }
.statistic-panel { padding: 1.15rem; }
.bulletin-panel { margin-bottom: 1rem; }
.spc-panel { margin-bottom: 1rem; }
.spc-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.spc-header .hint { margin-top: .2rem; }
.spc-state { padding: .6rem 1.15rem 1rem; color: var(--muted); }
.spc-event { padding: .9rem 1.15rem; overflow-wrap: anywhere; }
#spc-issues > h3 { margin: .8rem 1.15rem .4rem; }
.spc-panel summary { padding: .65rem 1.15rem; color: var(--accent-dark); font-weight: 650; cursor: pointer; border-top: 1px solid var(--line); }
.spc-summary { display: grid; justify-items: start; gap: .25rem; margin-block: .4rem; }
.spc-label { padding: .15rem .5rem; border-radius: 4px; color: #234d76; background: #e7eef9; font-size: .85rem; }
.spc-label.confirmed { color: #732b12; background: #ffead8; }
.spc-values { margin-block: .15rem; padding: 0; list-style: none; }
.rows .spc-values li { border: 0; }
.spc-values li { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .75rem; }
.spc-links { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.spc-links a, #spc-detail-body > a { font-size: .89rem; }
#spc-detail-body { margin-top: 1rem; overflow-wrap: anywhere; }
.spc-versions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .6rem; margin-top: 1rem; }
.spc-version { display: grid; align-content: start; justify-items: start; gap: .2rem; background: #f2f6fa; padding: .65rem .8rem; font-size: .86rem; }
.spc-version h4 { margin: 0 0 .25rem; }
.spc-hash { min-width: 0; font-size: .79rem; }
.spc-hash code { user-select: all; }
.spc-diff p { display: grid; grid-template-columns: 6rem 1fr; gap: .65rem; padding: .35rem .5rem; font-size: .9rem; }
.spc-diff p strong { font-size: .8rem; }
.spc-diff p span { min-width: 0; white-space: pre-wrap; }
.spc-diff [data-type="removed"] { background: #fae7e5; }
.spc-diff [data-type="added"] { background: #e1f1e7; }
.bulletin-event { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: .65rem 1.15rem; gap: .25rem 1rem; }
.bulletin-event > a { font-size: .85rem; white-space: nowrap; }
#bulletin-detail-source { display: inline-block; margin-top: .6rem; }
.bar-list { display: grid; gap: .78rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.bar-row { min-width: 0; }
.bar-caption { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; font-size: .86rem; }
.bar-caption span, .bar-caption a { overflow-wrap: anywhere; }
.bar-caption strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.bar-row meter { display: block; width: 100%; height: .46rem; margin-top: .28rem; }
.bar-row meter::-webkit-meter-bar { background: #e7edf4; border: 0; border-radius: 2px; }
.bar-row meter::-webkit-meter-optimum-value { background: #137c90; }
.bar-row meter::-moz-meter-bar { background: #137c90; }
#holders meter::-webkit-meter-optimum-value { background: #435faa; }
#holders meter::-moz-meter-bar { background: #435faa; }
.change-days { margin-block: .7rem .4rem; padding: .75rem; background: #f5f8fb; border-radius: 8px; }
.history-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .65rem; }
.history-status dd { margin: .08rem 0 0; font-size: .84rem; font-variant-numeric: tabular-nums; }
.change-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.change-totals > div { min-width: 0; background: #f2f6fa; border-radius: 8px; padding: .6rem .75rem; }
.change-totals dt { color: var(--muted); font-size: .8rem; }
.change-totals dd { margin: .15rem 0 0; line-height: 1.2; font-size: 1.42rem; font-weight: 720; }
.panel-header { padding: 1.1rem 1.15rem .75rem; }
.controls { display: flex; flex-wrap: wrap; gap: .7rem 1rem; align-items: flex-end; margin-top: .8rem; }
.control { display: grid; flex: 1 1 160px; gap: .25rem; min-width: 0; }
.control span, .control label, .checkbox { color: var(--muted); font-size: .85rem; font-weight: 670; }
.control input, .control select, .segments button, .pager button, .detail-header button, .catalog-actions button {
    min-height: 42px;
    padding: .45rem .65rem;
    border: 1px solid #a9bfba;
    border-radius: 7px;
    background: white;
    color: var(--ink);
}
.control input, .control select { width: 100%; }
.checkbox { display: flex; align-items: center; min-height: 42px; gap: .4rem; }
.checkbox input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; }
.segments button[aria-pressed="true"] { color: white; background: var(--accent); border-color: var(--accent); }
.segments button:not([aria-pressed="true"]):hover, .pager button:not(:disabled):hover, .detail-header button:hover { background: #e6f3ee; }
.hint { margin-top: .7rem; color: var(--muted); font-size: .85rem; }
.rows, .history { margin: 0; padding: 0; list-style: none; }
.rows li { border-top: 1px solid var(--line); }
.row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    gap: .35rem .65rem;
    text-align: left;
    border: 0;
    color: var(--ink);
    background: transparent;
    padding: .7rem 1.15rem;
    align-items: center;
}
.row:hover { background: #f0f8f5; }
.row { text-decoration: none; }
.row:focus-visible { outline-offset: -3px; }
.row-label { font-weight: 700; overflow-wrap: anywhere; }
.row-meta { display: block; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.tag {
    white-space: nowrap;
    align-self: start;
    border-radius: 4px;
    padding: .12rem .42rem;
    background: #e1f1e7;
    color: #20553a;
    font-size: .76rem;
    font-weight: 680;
}
.tag[data-type="updated"] { background: #e7eef9; color: #234d76; }
.tag[data-type="missing_from_export"] { background: #f8e9e4; color: #7f3322; }
.pager {
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .45rem;
    padding: .75rem 1.15rem;
    font-size: .84rem;
}
.notice { padding: .8rem 1rem; background: white; border: 1px solid var(--line); border-radius: 8px; }
.notice[role="alert"] { color: #7f3322; }

dialog {
    width: min(700px, 100% - 2rem);
    max-height: min(88dvh, 820px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    color: var(--ink);
    overflow: auto;
}
dialog::backdrop { background: rgb(13 37 34 / .58); }
.detail-header {
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.detail-header p { margin-top: .25rem; color: var(--muted); font-size: .87rem; }
.detail-content { padding: 1rem 1.15rem; }
.detail-content h3 { margin-block: 1.2rem .55rem; }
#detail-state { color: var(--muted); }
.history li { padding-block: .75rem; border-top: 1px solid var(--line); }
.history-header { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .6rem; overflow-wrap: anywhere; }
.history-header time { color: var(--muted); font-size: .84rem; }
.history table { width: 100%; margin-top: .5rem; border-collapse: collapse; table-layout: fixed; font-size: .85rem; }
.history th, .history td { text-align: left; border-bottom: 1px solid var(--line); padding: .34rem .35rem; overflow-wrap: anywhere; vertical-align: top; }
.history thead, .history td:first-child { font-weight: 650; }
.history thead th { background: #f0f6f4; }
.record { margin-top: .45rem; display: grid; gap: .15rem; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.detail-package-list { list-style: none; margin: 0; padding: 0; }
.detail-package-list li { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 2fr); gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.detail-package-list li span { color: var(--muted); }
.detail-classification { display: grid; gap: .45rem; margin-block: .9rem 0; overflow-wrap: anywhere; }
.detail-classification dt { color: var(--muted); font-size: .8rem; font-weight: 650; }
.detail-classification dd { margin: 0; }

.catalog-controls { padding: 1rem 1.15rem; }
.catalog-topline { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.catalog-topline .hint { margin: 0; }
.catalog-topline .segments { display: flex; flex-wrap: wrap; }
.catalog-search { flex: 1.5 1 210px; }
.catalog-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.catalog-actions button { font-size: .88rem; font-weight: 650; }
.catalog-actions button:hover { background: #f2f6fa; }
.catalog-actions .primary-button { background: var(--accent); color: white; border-color: var(--accent); }
.catalog-actions .primary-button:hover { background: var(--accent-dark); }
#catalog-grid { height: clamp(440px, 66vh, 780px); border-top: 1px solid var(--line); }
.grid-detail-link { text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--accent-dark); }
.grid-detail-link:hover { text-decoration: underline; }

@media (max-width: 810px) {
    .layout { grid-template-columns: 1fr; gap: 1rem; }
}

@media (max-width: 520px) {
    .shell { width: calc(100% - 1.5rem); }
    .topbar-content { min-height: 56px; gap: .7rem; }
    .topbar nav { gap: .45rem .7rem; justify-content: flex-end; }
    .topbar nav a { font-size: .77rem; }
    .catalog-controls { padding-inline: .8rem; }
    .catalog-search { flex-basis: 100%; }
    #catalog-grid .ag-paging-panel { gap: .25rem; }
    #catalog-grid .ag-paging-page-size { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; gap: .65rem; }
    .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .summary div { padding: .6rem .8rem; }
    .panel-header, .row, .pager { padding-inline: .8rem; }
    .row { grid-template-columns: minmax(0, 1fr); }
    .row .tag { justify-self: start; }
    .controls { gap: .45rem .65rem; }
    .control { flex-basis: 140px; }
    dialog { width: calc(100% - 1rem); }
    .detail-header, .detail-content { padding-inline: .85rem; }
}
