:root {
    --status-verified: #2ecc40;
    --status-good: #0074d9;
    --status-questionable: #ffdc00;
    --status-bad: #ff4136;
    --nav-bar-height: 36px;
    --logo-height: 40px;
    --pico-muted-border-color: rgb(243, 244, 247);
    --pico-typography-spacing-vertical: 0.6rem;
    --pico-line-height: 1.4;
    --pico-block-spacing-vertical: 0.6rem;
    --disc-filter-max-width: 50rem;
}

a {
    text-decoration: none;
    color: #035c90;
}
a:hover {
    text-decoration: underline;
}

html {
    font-size: 100%;
}
@media (max-width: 768px) {
    .disc-table .title-col {
        min-width: 30rem;
    }
    .disc-table .truncate {
        max-width: 5rem;
    }
    .letter-picker a {
        font-size: 1rem;
    }
    .about-qa {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

button,
[type="submit"],
[role="button"] {
    font-size: 0.8rem;
    padding: 0.35rem 1rem;
}

.container {
    max-width: 100% !important;
    padding-left: 2rem;
    padding-right: 2rem;
}
@media (max-width: 768px) {
    .container {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }
}

main.container {
    padding-top: 0rem;
    padding-bottom: 0.15rem;
    margin-top: 0;
}
main.container > *:first-child {
    margin-top: 0 !important;
}

footer.container {
    margin-top: 0.6rem;
    text-align: center;
}
footer.container hr {
    margin: 0.55rem 0 0.25rem;
}
footer.container p {
    margin: 0 0 0.35rem;
    line-height: 1.2;
}
[data-theme="dark"] footer hr {
    border-color: rgba(255, 255, 255, 0.1);
}

main > h3 {
    font-size: 1.22rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}


/* Flag icons — sized to match font height */
.flag-icon {
    height: 1.1em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    margin: 0 1px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Status dots */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.2rem;
}
.status-dot.verified { background: var(--status-verified); }
.status-dot.unverified { background: var(--status-good); }
.status-dot.questionable { background: var(--status-questionable); }
.status-dot.bad { background: var(--status-bad); }

/* Scrollable table container with sticky header */
/* Compact tables for disc listing */
.disc-table {
    width: 100%;
}

/* Reusable horizontal scroll wrapper for tables */
.table-scroll {
    overflow-x: auto;
}

/* Keep specific tables content-width instead of full width */
.table-scroll-compact > table {
    display: inline-table;
    width: max-content;
    max-width: none;
}

/* Compact standalone tables without a scroll wrapper */
.table-compact {
    display: inline-table;
    width: max-content;
    max-width: none;
}

.table-nowrap th,
.table-nowrap td {
    white-space: nowrap;
}
.disc-table td, .disc-table th {
    padding: 0.04rem 0.5rem;
    font-size: 0.85rem;
    vertical-align: middle;
}
.disc-table td a {
    text-decoration: none;
}
.disc-table tr:not(.clickable-row) td a:hover {
    text-decoration: underline;
}
.disc-table .title-col a {
    color: inherit;
}
[data-theme="dark"] .disc-table .title-col a {
    color: #CDE6F3;
}
.disc-table .title-col .foreign-title {
    margin-top: 0.08rem;
    font-size: 0.72rem;
    line-height: 1.2;
    color: #6b7280;
}
[data-theme="dark"] .disc-table .title-col .foreign-title {
    color: #C0C6D0;
}
.disc-table .submission-title-col a {
    color: inherit;
}
[data-theme="dark"] .disc-table .submission-title-col a {
    color: #CDE6F3;
}
[data-theme="dark"] .disc-table th:not(.title-col) a,
[data-theme="dark"] .disc-table td:not(.title-col):not(.submission-title-col) a {
    color: #BED4DF;
}
[data-theme="dark"] .disc-table th:not(.title-col) a:hover,
[data-theme="dark"] .disc-table td:not(.title-col):not(.submission-title-col) a:hover {
    color: #DDEFF7;
}

.submission-type-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125rem;
    background-color: #999;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.submission-type-icon-disc {
    -webkit-mask-image: url("/static/icons/tabler/disc.svg");
    mask-image: url("/static/icons/tabler/disc.svg");
}
.submission-type-icon-edit {
    -webkit-mask-image: url("/static/icons/tabler/edit.svg");
    mask-image: url("/static/icons/tabler/edit.svg");
}
.submission-type-icon-new-disc {
    background-color: var(--status-good);
}
.submission-type-icon-verification {
    background-color: var(--status-verified);
}
.submission-type-icon-edit-pending {
    background-color: var(--status-questionable);
}
.submission-type-icon-processed {
    background-color: #999;
}

/* Merge flags in region and language columns */
.disc-table .region-col .flag-icon,
.recent-dumps .region-col .flag-icon,
.disc-table .language-col .flag-icon {
    margin: 0 -1px 0 0;
}

.region-flags {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: max-content;
    max-width: calc(4 * 1.55em);
    line-height: 1;
    vertical-align: middle;
}

/* Keep language flags compact but not touching */
.disc-table .language-col .flag-icon {
    margin-right: 1px;
}

/* Shrink-to-fit columns: dumped-by-me, region, system, status */
.disc-table .dumped-by-me-col,
.disc-table .date-col,
.disc-table .type-col,
.disc-table .disc-id-col,
.disc-table .region-col,
.disc-table .system-col,
.disc-table .status-col {
    width: 1%;
    white-space: nowrap;
}

.disc-table .dumped-by-me-col,
.disc-table .date-col,
.disc-table .type-col,
.disc-table .disc-id-col,
.disc-table .region-col,
.disc-table .status-col {
    text-align: center;
}

.disc-table .language-col {
    text-align: left;
    max-width: 8.8em;
}

.disc-table td.region-col {
    white-space: normal;
}

.disc-table .dumped-by-me-yes {
    color: #2e7d32;
    font-weight: 600;
}

.disc-table .dumped-by-me-no {
    color: #c62828;
    font-weight: 600;
}

/* Ellipsis truncation for Edition and Serial */
.disc-table .truncate {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.disc-table .version-col { max-width: 7rem; }
.disc-table .edition-col { max-width: 7.5rem; }
.disc-table .serial-col  { max-width: 7rem; }

/* Striped table rows — matches home page alternating row style */
table.striped tbody tr:nth-child(odd) td {
    background-color: #F8FBFD !important;
}
table.striped th,
table.striped td {
    border-bottom: none !important;
}

/* Hide "Filters" summary label */
.filter-details > summary {
    display: none;
}

/* About page */
.about-page-title {
    text-align: center;
    margin-bottom: 0.75rem;
}
.about-qa {
    max-width: 820px;
    margin: 0 auto;
}
.qa-item {
    margin-bottom: 1.5rem;
}
.qa-question {
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
    text-align: center;
    color: #565e6a;
}
[data-theme="dark"] .qa-question {
    color: #C8CED8;
}
.qa-answer {
    font-size: 0.85rem;
    margin: 0;
}
.qa-answer li {
    font-size: 0.85rem;
}

/* Downloads page heading and description */
.downloads-page-title {
    text-align: center;
    margin-bottom: 0.75rem;
}
.downloads-page-desc {
    font-size: 0.8rem;
    text-align: center;
}

/* Downloads table — same width as home page recent dumps */
.downloads-table {
    width: max-content;
    max-width: 820px;
    margin: 0 auto;
    margin-bottom: 1rem;
}

/* Downloads table — font sizes and colors match home page recent dumps */
.downloads-table th {
    padding: 0.08rem 0.5rem;
    font-size: 0.9rem;
    text-align: left;
    color: #565e6a;
}
.downloads-table td {
    padding: 0.08rem 0.5rem;
    font-size: 0.8rem;
    vertical-align: middle;
}
[data-theme="dark"] .downloads-table th {
    color: #C8CED8;
}
.downloads-table .downloads-group-header {
    text-align: center;
}
.download-links-cell {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
}

/* Disc count line — centered, match title font size */
details + p {
    text-align: center;
    margin-bottom: 0.15rem;
}
details + p small {
    font-size: 0.8rem;
}

/* Center pagination */
#disc-results nav[aria-label="Pagination"] ul {
    justify-content: center;
}
#disc-results nav[aria-label="Pagination"] ul li,
#disc-results nav[aria-label="Pagination"] ul li a {
    font-size: 0.8rem;
}

/* Page jump input */
.page-jump-form {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.8rem;
    white-space: nowrap;
}
.page-jump-input {
    width: 2.5rem;
    font-size: 0.8rem;
    padding: 0 0.3rem !important;
    height: 1.5em !important;
    margin: 0;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}
.page-jump-input::-webkit-inner-spin-button,
.page-jump-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Disc page title */
.disc-page-title {
    text-align: center;
    margin-bottom: 0.75rem;
}

.filter-details {
    margin-bottom: 0.15rem;
}

.disc-count-line {
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.15rem;
}

.disc-count-line small {
    font-size: 0.8rem;
}

#disc-results > nav[aria-label="Pagination"] {
    margin-top: 0;
    margin-bottom: 0.15rem;
}

/* Filter panel — 2×2 grid layout */
#filter-form {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    width: min(100%, var(--disc-filter-max-width));
    margin: 0 auto 5px;
    justify-content: center;
    align-items: center;
    gap: 5px 10px;
}
#filter-form.advanced-search-visible {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 36rem);
    justify-items: center;
    gap: 5px;
    align-items: center;
}
#filter-form label {
    display: grid;
    grid-template-columns: 5rem max-content;
    align-items: center;
    column-gap: 0.35rem;
    margin: 0;
    font-size: 0.75rem;
}
#filter-form:not(.advanced-search-visible) label {
    grid-template-columns: max-content max-content;
}
#filter-form.advanced-search-visible label,
#filter-form.advanced-search-visible .advanced-search-row {
    width: min(100%, calc(5rem + 0.35rem + var(--advanced-system-control-width, 21.875rem)));
}
#filter-form label span {
    align-self: center;
    text-align: right;
    line-height: 1.1;
}
#filter-form select {
    font-size: 0.75rem;
    /* Looser line-height + vertical padding so descenders (g, p, y) are never
       clipped by the select box on fonts that render taller glyphs. */
    line-height: 1.4;
    margin: 0 !important;
    /* Extra right padding so option text never collides with the dropdown chevron. */
    padding: 0.2rem 1.6rem 0.2rem 0.5rem !important;
    height: auto !important;
    min-height: 0;
    /* Pull the chevron closer to the right edge (Pico's default is 0.75rem). */
    background-position: right 0.5rem center;
}
#filter-form.queue-filter-form select {
    width: max-content;
    max-width: 100%;
}

#filter-form > .advanced-search-toggle {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    justify-self: center;
    gap: 0.35rem;
    width: max-content;
    min-height: 1.55rem;
    margin: 0;
    padding: 0.22rem 0.65rem;
    border: 1px solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-form-element-background-color);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--pico-primary);
}
[data-theme="dark"] #filter-form > .advanced-search-toggle {
    color: #CDE6F3;
}
#filter-form > .advanced-search-toggle:hover,
#filter-form > .advanced-search-toggle:focus-visible {
    background: #E8F2FA;
    text-decoration: none;
}
#filter-form > .advanced-search-toggle[aria-expanded="true"] {
    border-color: var(--pico-form-element-border-color);
    background: var(--pico-form-element-background-color);
}
[data-theme="dark"] #filter-form > .advanced-search-toggle:hover,
[data-theme="dark"] #filter-form > .advanced-search-toggle:focus-visible {
    background: #212B38;
    color: #DDEFF7;
}
#filter-form > .advanced-search-panel {
    box-sizing: border-box;
    grid-column: 1 / -1;
    width: 100%;
    margin: 0;
    padding: 0;
}
#filter-form.advanced-search-visible > .advanced-search-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 5px;
    align-items: center;
}
.advanced-search-icon {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    background-color: currentColor;
    -webkit-mask-image: url("/static/icons/tabler/search.svg");
    mask-image: url("/static/icons/tabler/search.svg");
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
}
#filter-form .advanced-search-row {
    display: grid;
    grid-template-columns: 5rem max-content;
    align-items: center;
    column-gap: 0.35rem;
    width: 100%;
    margin: 0 auto;
    font-size: 0.75rem;
}
#filter-form .advanced-search-row span {
    align-self: center;
    text-align: right;
}
#filter-form .advanced-search-row input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 1.6rem;
    height: auto;
    margin: 0;
    padding: 0.18rem 0.4rem;
    font-size: 0.75rem;
}
#filter-form.advanced-search-visible .advanced-search-row input[type="text"] {
    width: var(--advanced-system-control-width, 21.875rem);
    max-width: 100%;
}
#filter-form .advanced-search-row select {
    width: max-content;
    max-width: 100%;
}
#filter-form.advanced-search-visible select {
    width: max-content;
    max-width: 100%;
}
#filter-form.advanced-search-visible select[name="region"],
#filter-form.advanced-search-visible select[name="status"] {
    width: var(--advanced-dumper-control-width, max-content);
}
.advanced-search-actions {
    display: flex;
    justify-content: center;
    margin-top: 0.3rem;
}
#filter-form.advanced-search-visible .advanced-search-actions {
    justify-content: center;
    margin-top: 0;
}
.advanced-search-actions button {
    width: auto;
    margin: 0;
    padding: 0.22rem 0.8rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

@media (max-width: 640px) {
    #filter-form,
    #filter-form.advanced-search-visible {
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        max-width: 100%;
        justify-items: stretch;
    }
    #filter-form label,
    #filter-form:not(.advanced-search-visible) label,
    #filter-form.advanced-search-visible label,
    #filter-form .advanced-search-row,
    #filter-form.advanced-search-visible .advanced-search-row {
        box-sizing: border-box;
        grid-template-columns: 4.75rem minmax(0, 1fr);
        justify-self: center;
        width: min(100%, 20rem);
        max-width: 100%;
    }
    #filter-form select,
    #filter-form.advanced-search-visible select,
    #filter-form.advanced-search-visible select[name="region"],
    #filter-form.advanced-search-visible select[name="status"],
    #filter-form .advanced-search-row select,
    #filter-form.advanced-search-visible .advanced-search-row input[type="text"] {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
}

/* Letter picker */
.letter-picker {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.16rem;
    max-width: var(--disc-filter-max-width);
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    margin-bottom: 0.35rem;
}
.letter-picker a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.45rem;
    padding: 0 0.42rem;
    text-decoration: none;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 1;
    transition: background-color 0.15s;
}
.letter-picker a:not(:first-child) {
    width: 1.45rem;
    padding-left: 0;
    padding-right: 0;
}
.letter-picker a:hover {
    background-color: #E8F2FA;
}
[data-theme="dark"] .letter-picker a:hover {
    background-color: #212B38;
}
.letter-picker a.active {
    background: var(--pico-primary);
    color: var(--pico-primary-inverse);
    border-color: var(--pico-primary);
}

@media (max-width: 640px) {
    .letter-picker {
        display: grid;
        grid-template-columns: repeat(14, minmax(0, 1fr));
        gap: 0.12rem;
        width: min(100%, 22rem);
        max-width: 100%;
    }
    .letter-picker a,
    .letter-picker a:not(:first-child) {
        width: auto;
        min-width: 0;
        min-height: 0;
        aspect-ratio: 1;
        padding: 0;
        font-size: 0.72rem;
    }
}

/* Hex dump */
.hex-dump {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    white-space: pre;
    overflow-x: auto;
    background: var(--pico-code-background-color);
    padding: 0.75rem;
    border-radius: 4px;
    line-height: 1.4;
}

/* SBI highlight */
.sbi-highlight {
    color: var(--status-bad);
    font-weight: bold;
}

/* Disc view — apply home page table design to all tables */
.disc-view table tbody tr:nth-child(odd) td {
    background-color: #F5F9FC !important;
}
.disc-view table th,
.disc-view table td {
    border-bottom: none !important;
}
[data-theme="dark"] .disc-view table tbody tr:nth-child(odd) td {
    background-color: #12161C !important;
}

/* Disc view page — compact layout */
.disc-view {
    --disc-info-max-width: clamp(58ch, 36vw, 82ch);
    --disc-aux-max-width: clamp(24rem, 34vw, 48rem);
    font-size: 0.7rem;
}
.disc-view h2 { font-size: 1rem; text-align: center; margin-bottom: 0; font-weight: 600; }
.disc-view h3 { font-size: 0.9rem; text-align: center; margin-bottom: 0.15rem; margin-top: 0.2rem; }
.disc-view h4 { font-size: 0.78rem; margin-bottom: 0.15rem; }
/* Center sections and their tables */
.disc-view section {
    text-align: center;
    margin-bottom: 0.5rem;
}
.disc-view .grid > section {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
}
.disc-view .disc-side-stack > section {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
}
.disc-view .section-collapsible {
    width: fit-content;
    max-width: min(100%, var(--disc-aux-max-width));
    min-width: 0;
}
.disc-view .grid {
    display: grid;
    grid-template-areas: "disc dump aux";
    grid-template-columns: fit-content(var(--disc-info-max-width)) max-content fit-content(var(--disc-aux-max-width));
    justify-content: space-evenly;
    align-items: start;
    gap: 0.5rem 1rem;
    margin-bottom: 2.5rem;
}
.disc-view .disc-side-stack {
    display: contents;
}
.disc-view .grid > section.disc-info-section {
    grid-area: disc;
}
.disc-view .dump-info-section {
    grid-area: dump;
}
.disc-view .section-collapsible {
    grid-area: aux;
    justify-self: center;
}
@media (max-width: 960px) {
    .disc-view .grid {
        grid-template-areas:
            "disc side";
        grid-template-columns: fit-content(58ch) fit-content(24rem);
        justify-content: center;
        column-gap: clamp(1rem, 5vw, 4rem);
    }
    .disc-view .disc-side-stack {
        grid-area: side;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        width: min(100%, 24rem);
        min-width: 0;
    }
    .disc-view .dump-info-section,
    .disc-view .section-collapsible {
        grid-area: auto;
        justify-self: center;
        width: 100%;
    }
    .disc-view .disc-side-stack > .dump-info-section,
    .disc-view .disc-side-stack > .section-collapsible {
        width: 100%;
        max-width: 100%;
    }
    .disc-view .dump-info-section .table-compact {
        width: fit-content;
        max-width: 100%;
        margin-inline: auto;
        table-layout: auto;
    }
}
@media (max-width: 760px) {
    .disc-view .grid {
        grid-template-areas:
            "disc side";
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        justify-content: stretch;
        justify-items: stretch;
        column-gap: clamp(0.35rem, 2vw, 0.75rem);
    }
    .disc-view .grid > section.disc-info-section,
    .disc-view .disc-side-stack,
    .disc-view .dump-info-section,
    .disc-view .section-collapsible {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .disc-view .disc-side-stack {
        display: flex;
        align-items: stretch;
        gap: 0.35rem;
    }
    .disc-view .dump-info-section {
        grid-area: auto;
        justify-self: center;
    }
    .disc-view .section-collapsible {
        grid-area: auto;
    }
    .disc-view .table-compact {
        width: 100%;
        table-layout: fixed;
    }
    .disc-view .table-compact td,
    .disc-view .table-compact th {
        padding: 0.03rem 0.18rem;
        font-size: 0.58rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .disc-view .table-compact td:first-child,
    .disc-view .table-compact th:first-child {
        padding-left: 0.2rem;
    }
    .disc-view .table-compact td:last-child,
    .disc-view .table-compact th:last-child {
        padding-right: 0.2rem;
    }
    .disc-view .disc-info-table td:first-child,
    .disc-view .dump-info-section .table-compact td:first-child {
        width: 3.4rem;
    }
    .disc-view h3 {
        font-size: 0.65rem;
    }
    .disc-view .status-dot {
        width: 8px;
        height: 8px;
        margin-right: 0.1rem;
    }
    .disc-view .section-collapsible .pre-wrap {
        width: 100%;
        font-size: 0.58rem;
        padding: 0.12rem 0.25rem;
    }
}
.disc-view .detail-section {
    border: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    padding: 0.15rem 0.55rem;
    margin-bottom: 0.3rem;
}
.disc-view .detail-section.table-fits {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.disc-view.has-overflowing-detail-sections .detail-section.table-fits {
    width: 100% !important;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}
.disc-view .detail-section.table-fits .table-scroll {
    width: max-content;
    max-width: 100%;
}
.disc-view .detail-section.table-fits .table-scroll > table {
    margin-left: 0;
    margin-right: 0;
}
.disc-view .detail-section.table-overflows {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}
.disc-view .detail-section.table-overflows .table-scroll {
    width: 100%;
}
.disc-view .detail-section.table-overflows .table-scroll > table {
    margin-left: 0;
    margin-right: 0;
}
.disc-view table {
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}
.disc-view table td,
.disc-view table th {
    padding: 0.15rem 0.4rem;
}
.disc-view .table-compact td,
.disc-view .table-compact th,
.disc-view .table-scroll-compact > table td,
.disc-view .table-scroll-compact > table th {
    padding: 0.04rem 0.35rem;
    font-size: 0.85rem;
    vertical-align: middle;
}
.disc-view .table-compact td:first-child,
.disc-view .table-compact th:first-child,
.disc-view .table-scroll-compact > table td:first-child,
.disc-view .table-scroll-compact > table th:first-child {
    padding-left: 0.5rem;
}
.disc-view .table-compact td:last-child,
.disc-view .table-compact th:last-child,
.disc-view .table-scroll-compact > table td:last-child,
.disc-view .table-scroll-compact > table th:last-child {
    padding-right: 0.5rem;
}
.disc-view .table-compact th,
.disc-view .table-scroll-compact > table th {
    text-align: left;
}
.disc-view .grid > section.disc-info-section {
    width: fit-content;
    max-width: min(100%, var(--disc-info-max-width));
}
.disc-view .disc-info-table {
    width: auto;
    max-width: 100%;
    table-layout: auto;
}
.disc-view .disc-info-table td:first-child {
    width: 7rem;
}
.disc-view .disc-edition-cell {
    max-width: calc(var(--disc-info-max-width) - 8rem);
    white-space: normal;
}
.disc-view .disc-edition-value {
    display: block;
    max-width: calc(var(--disc-info-max-width) - 8rem);
    white-space: normal;
    overflow-wrap: break-word;
}
@media (max-width: 760px) {
    .disc-view .grid > section.disc-info-section {
        width: 100%;
        max-width: 100%;
    }
    .disc-view .table-compact td,
    .disc-view .table-compact th {
        padding: 0.03rem 0.18rem;
        font-size: 0.58rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .disc-view .table-compact td:first-child,
    .disc-view .table-compact th:first-child {
        padding-left: 0.2rem;
    }
    .disc-view .table-compact td:last-child,
    .disc-view .table-compact th:last-child {
        padding-right: 0.2rem;
    }
    .disc-view .disc-info-table td:first-child,
    .disc-view .dump-info-section .table-compact td:first-child {
        width: 3.4rem;
    }
}
.disc-view .binary-table code {
    font-size: 0.62rem;
    letter-spacing: 0;
}
.disc-view .binary-table td,
.disc-view .binary-table th,
.disc-view .ring-table td,
.disc-view .ring-table th {
    padding: 0.05rem 0.25rem;
    font-size: 0.75rem;
    line-height: 1.2;
    vertical-align: middle !important;
}
.disc-view .detail-section .disc-table td,
.disc-view .detail-section .disc-table th,
.disc-view .detail-section .binary-table td,
.disc-view .detail-section .binary-table th,
.disc-view .detail-section .ring-table td,
.disc-view .detail-section .ring-table th {
    padding: 0.05rem 0.25rem;
    font-size: 0.75rem;
    line-height: 1.2;
    vertical-align: middle !important;
}
.disc-view .detail-section .disc-table {
    font-size: 0.7rem;
}
.disc-view .detail-section .disc-table code,
.disc-view .detail-section .binary-table code,
.disc-view .detail-section .ring-table code {
    vertical-align: middle;
}
.disc-view .binary-table code,
.disc-view .disc-table code,
.disc-view .ring-table code {
    vertical-align: middle;
    line-height: inherit;
    padding: 0;
    background: none;
    border-radius: 0;
    font-size: inherit;
}
.disc-view table td:first-child {
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
    width: 1%;
}
.disc-view .flags-inline .flag-icon {
    margin: 0;
}
.disc-view .flags-language .flag-icon {
    margin: 0;
}
.disc-view .flags-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    align-items: center;
}

/* Left-justified sections on disc view (Files, PVD, PIC, Rings) */
.disc-view .left-section {
    text-align: left;
}
.disc-view .left-section h3 {
    text-align: left;
}
.disc-view .left-section details > summary {
    margin: 0;
}

/* Dat filename label under Files heading — matches PVD row height */
.dat-filename {
    font-size: 0.82rem;
    line-height: 1.2;
    text-align: left;
    margin: 0 0 0.35rem 0;
    padding: 0;
}
.dat-filename code {
    padding-top: 0;
    padding-bottom: 0;
    line-height: inherit;
    vertical-align: middle;
}

/* Preserve newlines in multiline text blocks */
.pre-wrap {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 0.85rem;
}
.disc-view .section-collapsible .pre-wrap {
    width: max-content;
    max-width: min(100%, var(--disc-aux-max-width));
    margin-inline: auto;
    text-align: left;
    padding: 0.15rem 0.5rem;
    border-radius: var(--pico-border-radius);
    background: #F5F9FC;
}
[data-theme="dark"] .disc-view .section-collapsible .pre-wrap {
    background: #12161C;
}
.disc-view .section-collapsible .disc-comments,
.disc-view .section-collapsible .disc-contents {
    text-align: left;
}
.disc-view .section-collapsible :is(xmp, pre, code) {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Protection — show 5-line preview when collapsed */
.protection-details:not([open]) p {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

/* Contents disclosure arrow — suppress Pico's float-right chevron, use inline arrow instead */
.disc-view details > summary {
    list-style: none;
    display: flex;
    align-items: center;
    width: fit-content;
    margin: 0 auto;
    cursor: pointer;
}
.disc-view details > summary::-webkit-details-marker {
    display: none;
}
.disc-view details > summary::marker {
    content: '';
}
/* Hide Pico's ::after chevron */
.disc-view details > summary::after {
    display: none !important;
}
/* Custom arrow via ::before on the h3 inside summary */
.disc-view details > summary h3::after {
    content: ' ▶';
    font-size: 0.65em;
    margin-left: 0.3rem;
    display: inline-block;
    transition: transform 0.15s;
    vertical-align: middle;
}
.disc-view details[open] > summary h3::after {
    transform: rotate(90deg);
}

/* Title box — bordered container around main title and foreign title */
.disc-title-box {
    border: 1px solid #c8cdd6;
    border-radius: var(--pico-border-radius);
    padding: 0.53rem 0.8rem 0.65rem;
    margin: 0 auto 0.75rem; /* overridden to 0 when inside .disc-title-row */
    text-align: center;
    width: fit-content;
    background: #F5F9FC;
}
[data-theme="dark"] .disc-title-box {
    border-color: #2B3645;
    background: transparent;
}

.disc-title-row {
    --disc-title-actions-space: 4.5rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}
.disc-title-row.has-edit-action {
    --disc-title-actions-space: 8.5rem;
}
.disc-title-row .disc-title-box {
    grid-column: 1;
    grid-row: 1;
    justify-self: center;
    min-width: 0;
    max-width: calc(100% - (var(--disc-title-actions-space) * 2));
    margin-bottom: 0;
}
.disc-title-actions {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.disc-title-box h2 {
    overflow-wrap: anywhere;
}
.disc-title-actions [role="button"] {
    width: auto;
    margin: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    line-height: 1.2;
}
.disc-bottom-actions {
    display: none;
}
@media (max-width: 720px) {
    .disc-title-row {
        grid-template-columns: 1fr;
    }
    .disc-title-row .disc-title-box {
        grid-column: 1;
        grid-row: auto;
        justify-self: center;
        max-width: 100%;
    }
    .disc-title-actions {
        display: none;
    }
    .disc-bottom-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 0.35rem;
        width: 100%;
        margin-top: 0.75rem;
        margin-bottom: 0.35rem;
    }
    .disc-bottom-actions [role="button"] {
        width: 100%;
        margin: 0;
        padding: 0.45rem 0.6rem;
        font-size: 0.8rem;
        line-height: 1.2;
        text-align: center;
    }
    footer.container {
        margin-top: -0.25rem;
    }
    footer.container hr {
        margin: 0.25rem 0 0.2rem;
    }
    footer.container p {
        margin-bottom: 0.2rem;
    }
}
.col-num {
    text-align: right;
}
.dumpers-cell {
    white-space: normal;
    max-width: 10rem;
}

/* Foreign title — sits directly under main h2, same size as section headings */
.disc-view h2.foreign-title {
    margin-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--pico-muted-color);
    font-weight: 550;
}

/* Ring code table */
.ring-table th,
.ring-table td {
    width: auto;
    white-space: nowrap;
}
.files-table th,
.files-table td {
    width: auto;
    white-space: nowrap;
}
.disc-view .files-table tbody tr.files-synthetic-row td {
    background-color: #edf1f5 !important;
    border-top: 1px dashed #c4ccd6 !important;
    color: #5c6673;
}
[data-theme="dark"] .disc-view .files-table tbody tr.files-synthetic-row td {
    background-color: #181C24 !important;
    border-top-color: #4A5462 !important;
    color: #C0C6D0;
}
/* Keep ring rows aligned when # column is row-spanned */
.disc-view .table-scroll-compact > table.ring-table {
    table-layout: fixed;
}
.disc-view .table-scroll-compact > table.ring-table td:first-child,
.disc-view .table-scroll-compact > table.ring-table th:first-child,
.disc-view .table-scroll-compact > table.ring-table .ring-layer-col {
    text-align: center;
    width: 3ch;
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}
.disc-view .table-scroll-compact > table.ring-table .ring-entry-col {
    width: 3ch;
}
.ring-group-start > td {
    border-top: 1px solid #F5F9FC;
}
[data-theme="dark"] .ring-group-start > td {
    border-top-color: #2B3645;
}
.ring-entry-even > td {
    background: rgba(0,0,0,0.04);
}
.ring-table .entry-num {
    vertical-align: middle !important;
    font-weight: 600;
}
.ring-table .ring-fixed-cell {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    font-weight: 400;
    color: #2b2f35;
}
.ring-table .ring-fixed-cell * {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
[data-theme="dark"] .ring-table .ring-fixed-cell {
    color: #C0C6D0;
}
.ring-tab-marker {
    display: inline-block;
    width: 3ch;
    height: 1em;
    vertical-align: -0.1em;
}

.disc-view .tracks-table.striped tbody tr.tracks-session-row td {
    text-align: left !important;
    background: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="dark"] .disc-view .tracks-table.striped tbody tr.tracks-session-row td {
    background: #181C24 !important;
}
.tracks-table .tracks-total-row td {
    border-top: var(--pico-border-width) solid var(--pico-form-element-border-color);
}

/* ===== Nav: two-row layout ===== */
/* Use header prefix for specificity over Pico's nav element rules */
header .site-nav {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch;
    gap: 0;
    padding: 0 !important;
    padding-top: 0.3rem !important;
    padding-bottom: 0.3rem !important;
    overflow: visible;
}

/* Row 1: logo + search + login */
header .site-nav-top {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}
.site-banner {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    flex-shrink: 0;
}
.site-banner img {
    display: block;
    height: var(--logo-height);
    width: auto;
}

/* Auth list (username/logout or login) */
.site-nav-auth {
    display: flex !important;
    flex-direction: row !important;
    flex-shrink: 0;
    list-style: none;
    margin: 0 !important;
    padding: 0;
    align-items: center;
    gap: 1rem;
}
.site-nav-auth > li > [role="button"],
.site-nav-auth > li > button[type="submit"],
.site-nav-auth > li > form > button[type="submit"],
.user-menu-button {
    height: var(--nav-bar-height) !important;
    min-height: var(--nav-bar-height) !important;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    padding: 0 1rem;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1;
}
.user-menu-button {
    width: auto !important;
    justify-content: flex-start;
    gap: 0;
    padding: 0 0.55rem 0 0 !important;
    font-size: 0.8rem;
    line-height: 1;
    border: 1.5px solid #9fb1c3;
    border-radius: var(--pico-border-radius);
    background: var(--pico-form-element-background-color);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
    color: inherit;
    appearance: none;
    overflow: hidden;
}
.user-menu-button:is(:hover, :focus) {
    background: #E8F2FA;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
    color: inherit;
}
.user-menu-button:is(:hover, :focus) .user-menu-icon {
    background: transparent;
    box-shadow: none;
}
.user-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--nav-bar-height);
    height: var(--nav-bar-height);
    box-sizing: border-box;
    border: 0;
    border-right: 1.5px solid #9fb1c3;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 1.45rem;
    line-height: 1;
    overflow: hidden;
}
.user-menu-avatar,
.user-menu-silhouette {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.user-menu-avatar {
    display: block;
    object-fit: cover;
}
.user-menu-silhouette {
    line-height: 1;
}
.user-menu-username {
    display: inline-block;
    max-width: clamp(6ch, 12vw, 14ch);
    overflow: hidden;
    padding-left: 0.55rem;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}
[data-theme="dark"] .user-menu-button {
    border-color: #607085;
    background: var(--pico-form-element-background-color);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}
[data-theme="dark"] .user-menu-button:is(:hover, :focus) {
    background: #212B38;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}
[data-theme="dark"] .user-menu-icon {
    border-right-color: #607085;
    background: transparent;
    box-shadow: none;
}
[data-theme="dark"] .user-menu-button:is(:hover, :focus) .user-menu-icon {
    background: transparent;
    box-shadow: none;
}

/* Row 2: nav links */
header .site-nav-links {
    --nav-band-line-color: rgba(127, 145, 164, 0.22);
    --nav-band-fill-color: rgba(127, 145, 164, 0.035);
    --nav-band-solid: 15rem;
    --nav-band-fade: 12rem;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    list-style: none;
    margin: 0.7rem auto 0.09rem !important;
    padding: 0.08rem 0 !important;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-top: 0;
    border-bottom: 0;
    border-radius: 0;
    background: linear-gradient(
        90deg,
        transparent 0,
        transparent calc(50% - var(--nav-band-solid) - var(--nav-band-fade)),
        var(--nav-band-fill-color) calc(50% - var(--nav-band-solid)),
        var(--nav-band-fill-color) calc(50% + var(--nav-band-solid)),
        transparent calc(50% + var(--nav-band-solid) + var(--nav-band-fade)),
        transparent 100%
    ),
    linear-gradient(
        90deg,
        transparent 0,
        transparent calc(50% - var(--nav-band-solid) - var(--nav-band-fade)),
        var(--nav-band-line-color) calc(50% - var(--nav-band-solid)),
        var(--nav-band-line-color) calc(50% + var(--nav-band-solid)),
        transparent calc(50% + var(--nav-band-solid) + var(--nav-band-fade)),
        transparent 100%
    ) top / 100% 1px no-repeat,
    linear-gradient(
        90deg,
        transparent 0,
        transparent calc(50% - var(--nav-band-solid) - var(--nav-band-fade)),
        var(--nav-band-line-color) calc(50% - var(--nav-band-solid)),
        var(--nav-band-line-color) calc(50% + var(--nav-band-solid)),
        transparent calc(50% + var(--nav-band-solid) + var(--nav-band-fade)),
        transparent 100%
    ) bottom / 100% 1px no-repeat;
    overflow: visible;
    box-shadow: none;
}
[data-theme="dark"] header .site-nav-links {
    --nav-band-line-color: rgba(90, 107, 130, 0.32);
    --nav-band-fill-color: rgba(20, 26, 35, 0.45);
    box-shadow: none;
}
@media (max-width: 48rem) {
    header .site-nav-links {
        --nav-band-solid: 50%;
        --nav-band-fade: 0rem;
        /* Full-bleed to the screen edges by cancelling the container's 0.35rem
           side padding. Tied to the container (not 100vw), so it can never
           exceed the viewport and trigger shrink-to-fit. */
        width: calc(100% + 0.7rem) !important;
        max-width: none !important;
        margin-left: -0.35rem !important;
        margin-right: -0.35rem !important;
        position: relative;
    }

    header .site-nav-links::before,
    header .site-nav-links::after {
        content: "";
        position: absolute;
        left: 0;
        width: 100%;
        height: 1px;
        background: var(--nav-band-line-color);
        pointer-events: none;
    }

    header .site-nav-links::before {
        top: 0;
    }

    header .site-nav-links::after {
        bottom: 0;
    }
}
header .site-nav-links > li {
    display: flex;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
    border-left: 0;
    line-height: 1;
}
header .site-nav-links > li:first-child {
    border-left: 0;
}
[data-theme="dark"] header .site-nav-links > li {
    border-left-color: transparent;
}
.site-nav-auth > li {
    padding: 0 !important;
    margin: 0 !important;
}
.site-nav-links > li > a,
.site-nav-links > li > .submenu-label {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    min-height: 0;
    margin: 0 !important;
    padding: calc(0.36rem + 1px) 0.68rem !important;
    border-radius: var(--pico-border-radius);
    text-decoration: none;
    line-height: 1;
    font-weight: 500;
    color: var(--pico-primary);
    text-underline-offset: 0.25em;
    text-decoration-thickness: 1.5px;
    transition: background-color 0.15s, color 0.15s;
}
/* Narrow screens: shrink the nav links so the row fits on one line instead of
   overflowing horizontally (which triggers mobile shrink-to-fit). */
@media (max-width: 32rem) {
    .site-nav-links > li > a,
    .site-nav-links > li > .submenu-label {
        font-size: 0.9rem;
        padding-left: 0.2rem !important;
        padding-right: 0.2rem !important;
    }
}
[data-theme="dark"] .site-nav-links > li > a,
[data-theme="dark"] .site-nav-links > li > .submenu-label {
    color: inherit;
}
.site-nav-links > li > a:hover,
.site-nav-links > li > .submenu-label:hover {
    background-color: #E8F2FA;
    text-decoration: none;
}
.site-nav-links > li > a[aria-current="page"] {
    background-color: #EDF5FA;
    color: #0b5f91;
    text-decoration: none;
}
[data-theme="dark"] .site-nav-links > li > a:hover,
[data-theme="dark"] .site-nav-links > li > .submenu-label:hover {
    background-color: #212B38;
}
[data-theme="dark"] .site-nav-links > li > a[aria-current="page"] {
    background-color: #181C24;
    color: #CDE6F3;
}

/* Nav submenu dropdown */
.submenu-label {
    cursor: pointer;
    color: var(--pico-primary);
}
[data-theme="dark"] .submenu-label {
    color: #CDE6F3;
}
.has-submenu {
    position: relative;
}
.has-submenu .submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--pico-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    z-index: 100;
    min-width: 10rem;
}
[data-theme="dark"] .has-submenu .submenu {
    background: #14181E;
}
.user-menu .submenu {
    top: 100%;
    left: auto;
    right: 0;
    transform: none;
    min-width: 0;
    width: max-content;
    flex-direction: column;
    align-items: stretch;
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu {
    display: block;
}
.has-submenu.user-menu:hover > ul.user-submenu,
.has-submenu.user-menu:focus-within > ul.user-submenu {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
}
.user-submenu > li {
    display: block !important;
    width: 100%;
}
.submenu li {
    padding: 0 !important;
    margin: 0 !important;
}
.submenu-sep {
    color: var(--pico-muted-color);
    padding: 0 0.15rem !important;
    user-select: none;
}
.submenu li a,
.submenu li .submenu-disabled,
.submenu li .submenu-button {
    display: flex !important;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 1.8rem;
    margin: 0 !important;
    padding: 0.35rem 1rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    text-decoration: none;
}
.submenu li a:hover,
.submenu li .submenu-button:hover {
    background: #F5F9FC !important;
}
[data-theme="dark"] .submenu li a:hover,
[data-theme="dark"] .submenu li .submenu-button:hover {
    background: #212B38 !important;
}
.submenu li .submenu-disabled {
    color: var(--pico-muted-color);
    cursor: default;
}
.submenu-form {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}
.submenu li .submenu-button {
    appearance: none;
    color: var(--pico-primary);
    cursor: pointer;
}
.user-submenu li a,
.user-submenu li .submenu-disabled,
.user-submenu li .submenu-button {
    width: 100%;
}
.user-submenu .submenu-form {
    width: 100%;
}

/* Search box */
nav .quick-search {
    display: flex;
    align-items: center;
    margin: 0;
    flex-shrink: 0;
}
nav .quick-search input[type="text"] {
    margin: 0;
    padding: 0 0.5rem;
    height: var(--nav-bar-height);
    box-sizing: border-box;
    font-size: 0.9rem;
    width: clamp(100px, 18vw, 200px);
    border: 1.5px solid #9fb1c3;
    background-color: var(--pico-form-element-background-color);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.08);
}
[data-theme="dark"] nav .quick-search input[type="text"] {
    border-color: #607085;
    background-color: var(--pico-form-element-background-color);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}

/* Homepage sections */
.home-sections {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 0;
}
.home-sections > section,
.home-data-column {
    width: 100%;
    max-width: 820px;
    text-align: center;
}
.home-data-column {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}
.home-data-column section {
    width: 100%;
    max-width: 100%;
    text-align: center;
}
@media (min-width: 1640px) {
    .home-sections {
        flex-direction: row;
        align-items: flex-start;
        column-gap: clamp(1rem, calc((100vw - 1640px) / 5), 5rem);
        justify-content: center;
    }
    .home-sections > section,
    .home-sections > .home-data-column {
        flex: 0 1 820px;
    }
}
.home-sections h3 {
    margin-bottom: 0.98rem;
    font-size: 1.22rem;
    font-weight: 600;
}
.home-sections p {
    margin-bottom: 0.29rem;
    font-size: 0.9rem;
}
.home-sections .home-news {
    text-align: left;
}
.home-news h3 {
    text-align: center;
}
.home-news-empty {
    text-align: left;
    font-size: 0.85rem;
}
.home-news-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.home-news-item {
    padding-top: 0.85rem;
    border-top: 1px solid #D7E1EA;
}
.home-news-item > .home-news-header {
    margin: 0 0 0.5rem;
    padding: 0;
    border-bottom: 0;
    background: transparent;
}
.home-news-header h4 {
    margin: 0 0 0.12rem;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.28;
}
.home-news .home-news-meta {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.45rem;
    margin: 0 0 0.35rem;
    color: #565e6a;
    font-size: 0.68rem;
    line-height: 1.15;
}
[data-theme="dark"] .home-news .home-news-meta {
    color: #A6AFBD;
}
.home-news-content {
    color: var(--pico-color);
    font-size: 0.86rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.home-news-content p,
.home-news-content ul,
.home-news-content ol,
.home-news-content blockquote,
.home-news-content pre {
    margin: 0 0 0.4rem;
}
.home-news-content > :last-child {
    margin-bottom: 0;
}
.home-news-content img {
    max-width: 100%;
    height: auto;
}
.home-news-content pre {
    overflow-x: auto;
    padding: 0.5rem;
    background: #F5F9FC;
}
.home-news-actions,
.home-news-forum-link {
    margin-top: 0.45rem;
    margin-bottom: 0;
}
.home-sections .home-news-actions,
.home-sections .home-news-forum-link {
    font-size: 0.86rem;
}
.home-news-actions a,
.home-news-forum-link a {
    color: #035c90;
    font-weight: 600;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
[data-theme="dark"] .home-news-actions a,
[data-theme="dark"] .home-news-forum-link a {
    color: #C8CED8;
}
.home-news-forum-link {
    text-align: center;
}
.recent-dumps-scaler,
.recent-changes-scaler {
    width: 100%;
    max-width: 100%;
}
.home-recent-dumps .recent-dumps {
    margin: 0 auto;
    text-align: left;
    width: 100%;
}
.home-recent-changes {
    display: none;
}
.home-recent-dumps .recent-dumps tbody tr:nth-child(n+21) {
    display: none;
}
@media (min-width: 1640px) {
    .home-recent-changes {
        display: block;
        padding-top: 0.9rem;
    }
    .home-recent-dumps .recent-dumps tbody tr:nth-child(n+21) {
        display: table-row;
    }
    .home-recent-dumps .recent-dumps tbody tr:nth-child(n+31) {
        display: none;
    }
    .home-recent-changes .recent-changes tbody tr:nth-child(n+31) {
        display: none;
    }
}
.home-recent-dumps p,
.home-recent-changes p {
    margin-top: 0.5rem;
    margin-bottom: 0;
}
.home-recent-dumps p a,
.home-recent-changes p a {
    color: #035c90;
    font-weight: bold;
}

/* Recent dumps table — alternating rows */
.recent-dumps tbody tr:nth-child(odd) td {
    background-color: #F8FBFD !important;
}
.recent-dumps th,
.recent-dumps td {
    border-bottom: none !important;
}

/* Recent dumps table */
.recent-dumps th {
    padding: 0.04rem 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
    text-align: left;
    color: #565e6a;
}
.recent-dumps td {
    padding: 0.04rem 0.5rem;
    font-size: 0.85rem;
    vertical-align: middle;
    white-space: nowrap;
}
.recent-dumps .date-col {
    width: 5.6rem;
    padding-left: 0.3rem;
    padding-right: 0.3rem;
}
.recent-dumps .region-col {
    text-align: center;
    white-space: normal;
}
.clickable-row {
    cursor: pointer;
}
.clickable-row a,
.clickable-row a:hover {
    text-decoration: none;
}
.clickable-row:hover td,
.clickable-row.is-row-hover td {
    background-color: #E8F2FA !important;
}
.recent-dumps tbody tr.clickable-row:hover td,
.recent-dumps tbody tr.clickable-row.is-row-hover td,
table.striped tbody tr.clickable-row:hover td,
table.striped tbody tr.clickable-row.is-row-hover td {
    background-color: #E8F2FA !important;
}
.clickable-row:focus-visible td {
    background-color: #E8F2FA !important;
    box-shadow: inset 0 1px 0 #8fb8d8, inset 0 -1px 0 #8fb8d8;
}
[data-theme="dark"] .clickable-row:hover td,
[data-theme="dark"] .clickable-row.is-row-hover td,
[data-theme="dark"] .recent-dumps tbody tr.clickable-row:hover td,
[data-theme="dark"] .recent-dumps tbody tr.clickable-row.is-row-hover td,
[data-theme="dark"] table.striped tbody tr.clickable-row:hover td,
[data-theme="dark"] table.striped tbody tr.clickable-row.is-row-hover td {
    background-color: #212B38 !important;
}
[data-theme="dark"] .recent-dumps tbody tr.clickable-row,
[data-theme="dark"] .disc-table tbody tr.clickable-row {
    --pico-color: #EDECEF;
    color: #EDECEF;
}
[data-theme="dark"] .clickable-row:focus-visible td {
    background-color: #212B38 !important;
    box-shadow: inset 0 1px 0 #506176, inset 0 -1px 0 #506176;
}

/* Queue status dots */
.status-dot-pending  { background: #f39c12; }
.status-dot-approved { background: var(--status-verified); }
.status-dot-rejected { background: var(--status-bad); }
.status-dot-legacy   { background: #999; }

/* Diff view */
.diff-add { background: #e6ffec; }
.diff-remove { background: #ffebe9; }

/* Dark mode toggle — inline pill switch next to login */
.dark-mode-toggle {
    flex-shrink: 0;
    width: 24px;
    height: 36px;
    border-radius: 12px;
    background: #F4F8FB;
    border: 0;
    box-shadow: 0 0 0 1.5px #9fb1c3, inset 0 1px 2px rgba(0,0,0,0.12);
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.2s, box-shadow 0.2s;
}
[data-theme="dark"] .dark-mode-toggle {
    background: #181C24;
    box-shadow: 0 0 0 1.5px #607085, inset 0 1px 2px rgba(0,0,0,0.35);
}
.dark-mode-toggle:focus-visible {
    outline: 2px solid #0172ad;
    outline-offset: 3px;
}
.dark-mode-toggle-thumb {
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #0172ad;
    margin-top: 2px;
    transition: margin-top 0.2s, background 0.2s;
}
[data-theme="dark"] .dark-mode-toggle-thumb {
    margin-top: 14px;
    background: #EDECEF;
}

/* Responsive nav adjustments */
@media (max-width: 768px) {
    .site-nav-top {
        flex-wrap: wrap;
    }
    .site-nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .disc-table {
        font-size: 0.75rem;
    }
}

/* Fieldset styling for forms */
fieldset {
    margin-bottom: 1rem;
}
fieldset legend {
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-form-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0;
    text-align: center;
}

.auth-form-label {
    text-align: center;
}
article input[type="text"],
article input[type="password"] {
    text-align: center;
}

/* Code blocks in submission detail */
pre code {
    font-size: 0.8rem;
    max-height: 400px;
    overflow-y: auto;
}

/* Footer online users */
#online-users a {
    text-decoration: none;
}
#online-users a:hover {
    text-decoration: underline;
}

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline;
}

/* Edit form — compact sizing to match disc list/view */
.disc-edit {
    font-size: 0.75rem;
}
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.disc-edit label,
.disc-edit fieldset legend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.disc-edit input[type="text"],
.disc-edit input[type="number"],
.disc-edit select,
.disc-edit textarea {
    font-size: 0.75rem;
    padding: 0.15rem 0.35rem;
    margin-bottom: 0.25rem;
    height: auto;
}
/* Selects need extra right padding so option text clears the dropdown chevron. */
.disc-edit select {
    padding-right: 1.6rem;
}
.disc-edit input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.disc-edit input[type="number"]::-webkit-inner-spin-button,
.disc-edit input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.disc-edit fieldset {
    margin-bottom: 0.25rem;
    padding: 0.3rem 0.5rem;
}
.disc-edit fieldset legend {
    font-size: 0.75rem;
}
.disc-edit .disc-form-section {
    margin: 0.6rem 0;
    padding: 0.55rem 0;
    border-top: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-bottom: var(--pico-border-width) solid var(--pico-form-element-border-color);
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(127, 145, 164, 0.04) 1.5rem,
        rgba(127, 145, 164, 0.04) calc(100% - 1.5rem),
        transparent 100%
    );
}
.disc-edit .disc-form-section:first-of-type {
    margin-top: 0.25rem;
    padding-bottom: 0.8rem;
}
.disc-edit .disc-form-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0.65rem;
    border-bottom: none;
}
body:has(.disc-edit) main.container {
    padding-bottom: 0;
}
body:has(.disc-edit) footer.container {
    margin-top: 0;
    padding-top: 0;
}
body:has(.disc-edit) footer.container hr {
    margin-top: 0;
}
[data-theme="dark"] .disc-edit .disc-form-section {
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(15, 20, 28, 0.55) 1.5rem,
        rgba(15, 20, 28, 0.55) calc(100% - 1.5rem),
        transparent 100%
    );
}
.disc-edit .disc-meta-fields {
    display: grid;
    gap: 0.18rem;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}
.disc-edit .disc-meta-row {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, max-content);
    align-items: center;
    column-gap: 0.45rem;
    max-width: 100%;
    margin: 0 !important;
}
.disc-edit .disc-meta-label {
    text-align: right;
    line-height: 1.1;
    white-space: nowrap;
}
.disc-edit .disc-meta-row > input[type="text"],
.disc-edit .disc-meta-row > select {
    margin-bottom: 0;
}
.disc-edit .disc-meta-row > input[type="text"] {
    width: clamp(16rem, 36vw, 34rem);
    max-width: 100%;
}
.disc-edit .disc-meta-row > select {
    width: max-content;
    max-width: 100%;
}
.disc-edit .disc-meta-row > input[name="disc_number"] {
    width: calc(3ch + 0.7rem + (var(--pico-border-width) * 2));
}
.disc-edit .disc-meta-row > .review-field-annotation {
    grid-column: 2;
    margin-top: 0.1rem;
}
.disc-edit .disc-meta-row > .transliterate-btn {
    grid-column: 3;
    justify-self: start;
    width: max-content;
    margin: 0;
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    white-space: nowrap;
}
.disc-edit .disc-meta-row > .transliterate-note {
    grid-column: 2 / -1;
    margin-top: 0.15rem;
    color: var(--pico-muted-color);
    font-size: 0.8rem;
}
.disc-edit .grid {
    gap: 0.35rem;
}
.disc-edit .flag-select-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 0.85rem;
    margin-bottom: 0;
}
.flag-list-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 0.45rem;
}
.flag-list-toggle {
    width: auto;
    margin: 0;
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
}
.disc-edit.disc-add:not(.show-all-flags) .flag-check-extra {
    display: none !important;
}
.disc-edit.disc-add:not(.show-all-flags) .flag-check-list {
    columns: 1;
    max-width: max-content;
}
.flag-select-languages {
    border-left: 1px solid #d7e1ea;
    padding-left: 0.85rem;
}
[data-theme="dark"] .flag-select-languages {
    border-left-color: #2B3645;
}
.disc-edit input[type="radio"] {
    margin: 0;
}

/* Edit form — flag checkbox lists */
.flag-check-list {
    columns: 2;
    column-gap: 0.75rem;
    gap: 0.15rem;
    max-width: 28rem;
}
@media (min-width: 82rem) {
    .flag-select-regions fieldset {
        width: fit-content;
        max-width: 100%;
        margin-left: auto;
        margin-right: 1.5rem;
    }
    .flag-check-list {
        columns: 3;
        column-gap: 1rem;
        max-width: 38rem;
    }
}
@media (min-width: 52.01rem) and (max-width: 81.99rem) {
    .flag-select-regions fieldset {
        width: fit-content;
        max-width: 100%;
        margin-left: auto;
        margin-right: 1.5rem;
    }
}
@media (max-width: 52rem) {
    .disc-edit .flag-select-grid {
        grid-template-columns: 1fr;
    }
    .flag-select-languages {
        border-left: none;
        padding-left: 0;
    }
    .flag-check-list {
        columns: 2;
    }
}
@media (max-width: 34rem) {
    .flag-check-list {
        columns: 1;
    }
}
.flag-check {
    display: flex !important;
    break-inside: avoid;
    align-items: center;
    gap: 0.35rem;
    width: auto;
    font-size: 0.75rem;
    cursor: pointer;
}
.flag-check input[type="checkbox"] {
    margin: 0;
}
.flag-check .flag-icon {
    height: 1em;
}
.flag-check span {
    white-space: nowrap;
    font-weight: normal;
}
.flag-check.flag-check-emphasis {
    margin: 0.02rem -0.18rem;
    padding: 0.05rem 0.18rem;
    border-left: 2px solid rgba(0, 119, 184, 0.32);
    border-radius: 4px;
    background: rgba(0, 119, 184, 0.08);
}
.flag-check.flag-check-emphasis:hover {
    background: rgba(0, 119, 184, 0.14);
}
[data-theme="dark"] .flag-check.flag-check-emphasis {
    border-left-color: rgba(125, 190, 255, 0.38);
    background: rgba(125, 190, 255, 0.12);
}
[data-theme="dark"] .flag-check.flag-check-emphasis:hover {
    background: rgba(125, 190, 255, 0.18);
}

/* Inline label + values row */
.inline-field {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
    padding: 0.12rem 0;
    border-bottom: var(--pico-border-width) solid var(--pico-form-element-border-color);
}
.inline-field:last-child {
    border-bottom: none;
}
.disc-form-section-inline .inline-field:first-child {
    padding-top: 0;
}
.disc-form-section-inline .inline-field:last-child {
    padding-bottom: 0;
}
.disc-form-section-inline .inline-field {
    padding-top: 0.22rem;
    padding-bottom: 0.22rem;
}
.disc-edit .disc-form-section-inline {
    display: grid;
    row-gap: 0.18rem;
    justify-content: center;
}
.disc-edit .disc-form-section-inline .inline-field {
    width: 100%;
    padding: 0.2rem 0.45rem;
    border-bottom: none;
    border-radius: 4px;
}
.disc-edit .disc-form-section-inline .inline-field:nth-of-type(even) {
    background: rgba(127, 145, 164, 0.07);
}
[data-theme="dark"] .disc-edit .disc-form-section-inline .inline-field:nth-of-type(even) {
    background: rgba(16, 21, 29, 0.72);
}
.disc-edit .disc-form-section-inline .inline-field-label {
    width: 6.8rem;
    min-width: 6.8rem;
}
.disc-edit .disc-form-section-inline .repeatable-inline-field {
    grid-template-columns: 6.8rem auto;
}
.inline-radios {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.inline-radios label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
    margin-bottom: 0;
}
#layerbreak-row {
    border-bottom: none;
}
.inline-field-label {
    font-weight: 600;
    white-space: nowrap;
    min-width: 5rem;
    text-align: right;
}
.inline-field-values {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}
#serial-list,
#edition-list,
#barcode-list {
    flex: 0 1 auto;
}
.repeatable-inline-field {
    display: grid;
    grid-template-columns: minmax(5rem, max-content) auto;
    grid-template-areas:
        "label values"
        ". add";
    column-gap: 0.35rem;
    row-gap: 0.2rem;
    justify-content: flex-start;
    align-items: flex-start;
}
.repeatable-inline-field .inline-field-label {
    grid-area: label;
    padding-top: 0.2rem;
}
.repeatable-inline-field .repeatable-inline-values {
    grid-area: values;
}
.repeatable-inline-field .array-add-btn {
    grid-area: add;
    margin-top: 0.05rem;
}
#serial-list,
#edition-list,
#barcode-list {
    flex-direction: column;
    align-items: flex-start;
}
#serial-list {
    justify-content: flex-start;
    text-align: left;
}
#serial-list input[name="serial"] {
    align-self: flex-start;
}
#barcode-list input[name="barcode"] {
    align-self: flex-start;
}
#serial-list + .array-add-btn,
#edition-list + .array-add-btn,
#barcode-list + .array-add-btn {
    align-self: flex-start;
}
.review-field-annotation {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    white-space: nowrap;
}
.inline-field-values > .review-field-annotation {
    order: 10;
    margin-top: 0.05rem;
}
.review-field-annotation-combined {
    flex-basis: auto;
    width: auto;
}
.inline-field-values > .review-field-annotation-combined {
    flex-basis: 100%;
    width: 100%;
}
.review-field-annotation-label {
    font-size: 0.72rem;
    opacity: 0.85;
}
.review-field-annotation-item {
    padding: 0 0.3rem;
    border-radius: 2px;
}
.inline-field-values .edition-value-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.06rem;
    flex: 0 0 auto;
    order: 0;
}
.disc-edit .submit-as-picker {
    display: flex;
    align-items: center;
    gap: 0.06rem;
}
.disc-edit .submit-as-picker input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
}
.disc-edit .inline-field-values input[type="text"],
.disc-edit .inline-field-values input[type="number"] {
    height: calc((0.75rem * var(--pico-line-height)) + 0.3rem + (var(--pico-border-width) * 2));
    box-sizing: border-box;
    margin-bottom: 0;
    line-height: var(--pico-line-height);
    align-self: center;
    flex: 0 0 auto;
    order: 0;
}
.disc-edit .inline-field-values input.short-code-input {
    width: calc(6ch + 0.7rem + (var(--pico-border-width) * 2));
}
.disc-edit .inline-field-values input.short-code-input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}
.disc-edit .inline-field-values input.short-code-input[type="number"]::-webkit-outer-spin-button,
.disc-edit .inline-field-values input.short-code-input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}
.disc-edit .inline-field-values select.edition-suggestion-select,
.disc-edit .submit-as-picker select.submit-as-user-select {
    display: block;
    width: calc((0.75rem * var(--pico-line-height)) + 0.3rem + (var(--pico-border-width) * 2));
    min-width: calc((0.75rem * var(--pico-line-height)) + 0.3rem + (var(--pico-border-width) * 2));
    height: calc((0.75rem * var(--pico-line-height)) + 0.3rem + (var(--pico-border-width) * 2));
    min-height: 0;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    margin-bottom: 0;
    padding: 0 !important;
    line-height: var(--pico-line-height);
    vertical-align: middle;
    background-color: var(--pico-form-element-background-color);
    background-image: var(--pico-icon-chevron);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 0.7rem auto;
    border: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    cursor: pointer;
    align-self: center;
    flex: 0 0 auto;
    order: 0;
}
.inline-field-values-stacked {
    align-items: flex-start;
    flex-direction: column;
}
.inline-field-values-stacked > .inline-field-values {
    flex: 0 0 auto;
}
.inline-field .array-add-btn {
    flex-shrink: 0;
    margin: 0;
}

.disc-edit .status-inline-row {
    margin-top: 0.25rem;
    justify-content: center;
}

.disc-edit .status-inline-row .inline-field-label {
    min-width: 0;
    text-align: left;
}

.disc-edit .status-inline-row .inline-field-values {
    flex: 0 0 auto;
}

.disc-edit .status-select-compact {
    width: auto;
    min-width: 9rem;
    flex: 0 0 auto;
    display: inline-block;
    margin-bottom: 0;
    padding-right: 1.6rem;
}

/* Repeatable array fields (layerbreaks, etc.) */
.array-editor {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}
.array-entry {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.array-entry input {
    margin-bottom: 0;
}
.array-entry .remove-entry {
    padding: 0.15rem 0.4rem;
    margin: 0;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.array-add-btn {
    width: fit-content;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
}

/* Ring code edit table */
.disc-edit fieldset:has(#ring-editor) {
    padding-top: 0.4rem;
    padding-bottom: 0.45rem;
    text-align: center;
}
.disc-edit fieldset:has(#ring-editor) legend {
    margin-bottom: 0.3rem;
}
.disc-edit fieldset:has(#ring-editor) .table-scroll {
    width: fit-content;
    max-width: 100%;
    margin: 0.1rem auto 0.15rem;
    text-align: left;
}
.ring-edit-table.ring-group-start > td,
.ring-edit-table .ring-group-start > td {
    border-top: var(--pico-border-width) solid var(--pico-form-element-border-color);
}
.ring-edit-table input[type="text"] {
    margin-bottom: 0;
    padding: 0.15rem 0.25rem;
    font-size: 0.72rem;
    height: auto;
}
.ring-edit-table th,
.ring-edit-table td {
    padding-top: 0.28rem;
    padding-bottom: 0.28rem;
}
.ring-edit-table .ring-layer-label-tooltip {
    display: inline-block;
    position: relative;
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 0.16em;
}
.ring-edit-table .ring-layer-label-tooltip::before,
.ring-edit-table .ring-layer-label-tooltip::after {
    position: absolute;
    top: 50%;
    left: calc(100% + 0.45rem);
    z-index: 20;
    display: none;
    pointer-events: none;
}
.ring-edit-table .ring-layer-label-tooltip::before {
    content: "";
    transform: translate(-0.35rem, -50%);
    border-top: 0.35rem solid transparent;
    border-bottom: 0.35rem solid transparent;
    border-right: 0.35rem solid #f3f6fa;
    filter: drop-shadow(-1px 0 0 #c7d1dc);
}
.ring-edit-table .ring-layer-label-tooltip::after {
    content: attr(data-ring-tooltip);
    width: max-content;
    max-width: min(28rem, calc(100vw - 2rem));
    transform: translateY(-50%);
    padding: 0.35rem 0.5rem;
    border: 1px solid #c7d1dc;
    border-radius: 4px;
    background: #f3f6fa;
    color: #17202b;
    box-shadow: 0 0.25rem 0.75rem rgba(20, 27, 36, 0.18);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: normal;
}
.ring-edit-table .ring-layer-label-tooltip:hover::before,
.ring-edit-table .ring-layer-label-tooltip:hover::after,
.ring-edit-table .ring-layer-label-tooltip:focus::before,
.ring-edit-table .ring-layer-label-tooltip:focus::after {
    display: block;
}
.ring-edit-table .ring-layer-label-tooltip:focus {
    outline: 1px solid #9fb1c3;
    outline-offset: 2px;
}
[data-theme="dark"] .ring-edit-table .ring-layer-label-tooltip:focus {
    outline-color: #607085;
}
[data-theme="dark"] .ring-edit-table .ring-layer-label-tooltip::before {
    border-right-color: #181C24;
    filter: drop-shadow(-1px 0 0 #35404D);
}
[data-theme="dark"] .ring-edit-table .ring-layer-label-tooltip::after {
    border-color: #35404D;
    background: #181C24;
    color: #C8CED8;
    box-shadow: 0 0.3rem 0.85rem rgba(0, 0, 0, 0.45);
}
.ring-edit-table .remove-entry {
    padding: 0.1rem 0.35rem;
    font-size: 0.7rem;
    margin: 0;
}

/* Hex dump textarea */
.hex-dump-input {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    line-height: 1.3;
}

/* Auto-expanding textareas */
textarea.auto-expand {
    overflow: hidden;
    resize: none;
}
textarea.fit-width {
    width: auto;
}
textarea.fixed-80 {
    width: 80ch;
}
textarea.full-width-textarea {
    width: 100%;
}

.disc-edit .disc-form-section-multiline {
    display: grid;
    justify-items: center;
}
.disc-edit .disc-form-section-multiline > label,
.disc-edit .disc-form-section-multiline > .multiline-review-field {
    width: fit-content;
    max-width: 100%;
    justify-self: center;
    text-align: left;
}
.disc-edit .disc-form-section-multiline > label:has(textarea[name="comments"]) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.multiline-review-field {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: flex-start;
    overflow-x: auto;
}
.disc-edit label:has(textarea[name="dump_log"]),
.disc-edit label:has(input[name="extra_upload_url"]),
.disc-edit label:has(input[name="submit_as"]),
.disc-edit label:has(textarea[name="submission_comment"]) {
    --submit-field-width: min(56rem, 100%);
    display: block;
    width: var(--submit-field-width);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}
.disc-edit textarea[name="dump_log"],
.disc-edit input[name="extra_upload_url"],
.disc-edit .submit-as-picker,
.disc-edit textarea[name="submission_comment"] {
    box-sizing: border-box;
    width: 100%;
}
.disc-edit label:has(textarea[name="review_comment"]) {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}
.disc-edit textarea[name="review_comment"] {
    box-sizing: border-box;
    width: 80ch;
    max-width: 100%;
}
.disc-edit input[name="extra_upload_url"],
.disc-edit textarea[name="submission_comment"] {
    text-indent: 0;
}
.multiline-review-field > label {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    width: auto;
}
.multiline-review-field > label > textarea {
    flex: 0 0 auto;
}
.review-old-textarea textarea {
    opacity: 0.95;
}

/* Validation message boxes */
.validation-errors,
.validation-result {
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--pico-border-radius, 0.25rem);
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.validation-errors {
    background: #ce7e7b;
}
.validation-result {
    font-weight: 600;
}
.validation-result-verification {
    background: #62af9a;
}
.validation-result-new {
    background: #0172ad;
}
.validation-result a {
    color: #035c90;
    font-weight: 700;
}
.validation-errors strong {
    display: block;
    margin-bottom: 0.35rem;
}
.validation-errors ul {
    margin: 0;
    padding-left: 1.25rem;
}
.validation-errors li {
    margin-bottom: 0.15rem;
}

.disc-edit .form-actions,
.disc-view .form-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 1rem;
    margin-top: 1rem;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: var(--pico-spacing);
    align-items: flex-end;
    width: min(100%, 32rem);
}
.disc-edit .disc-form-section:last-of-type .form-actions {
    margin-bottom: 0.35rem;
}
.disc-edit .disc-form-section:last-of-type > button[type="submit"] {
    display: block;
    width: min(100%, calc((32rem - 1rem) / 2));
    margin: 1rem auto 0.35rem;
    text-align: center;
}
.disc-edit .form-actions button,
.disc-edit .form-actions [type="submit"],
.disc-view .form-actions [role="button"] {
    flex: 1 1 0;
    min-width: 0;
    width: 100%;
    margin-bottom: 0;
    text-align: center;
}

/* Queue review: highlight changed fields */
.field-changed {
    background-color: rgba(255, 235, 59, 0.18);
    border-left: 3px solid rgba(255, 235, 59, 0.7);
    padding-left: 0.5rem;
}
.field-changed > legend,
.field-changed > .inline-field-label {
    padding: 0 4px;
    border-radius: 2px;
}
.field-added {
    background-color: rgba(76, 175, 80, 0.18);
    border-left: 3px solid rgba(76, 175, 80, 0.7);
    padding-left: 0.5rem;
}
.field-added > legend,
.field-added > .inline-field-label {
    padding: 0 4px;
    border-radius: 2px;
}
.field-removed {
    background-color: rgba(244, 67, 54, 0.18);
    border-left: 3px solid rgba(244, 67, 54, 0.7);
    padding-left: 0.5rem;
}
.field-removed > legend,
.field-removed > .inline-field-label {
    padding: 0 4px;
    border-radius: 2px;
}
.item-added { background-color: rgba(76, 175, 80, 0.18); }
.item-removed { background-color: rgba(244, 67, 54, 0.18); }
.item-changed { background-color: rgba(255, 235, 59, 0.18); }
tr.item-added > td { background-color: rgba(76, 175, 80, 0.18); }
tr.item-removed > td { background-color: rgba(244, 67, 54, 0.18); }
tr.item-changed > td { background-color: rgba(255, 235, 59, 0.18); }
tr.field-changed > td { background-color: rgba(255, 235, 59, 0.18); }

/* Queue submission info box */
.submission-info {
    font-size: 0.75rem;
    margin: 0.6rem 0;
    padding: 0.55rem 0;
    border-top: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-bottom: var(--pico-border-width) solid var(--pico-form-element-border-color);
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(127, 145, 164, 0.04) 1.5rem,
        rgba(127, 145, 164, 0.04) calc(100% - 1.5rem),
        transparent 100%
    );
}
[data-theme="dark"] .submission-info {
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(15, 20, 28, 0.55) 1.5rem,
        rgba(15, 20, 28, 0.55) calc(100% - 1.5rem),
        transparent 100%
    );
}
.submission-info .table-compact td {
    padding: 0.2rem 0.45rem;
    vertical-align: top;
}
.submission-info .table-compact td:first-child {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}
.submission-info .table-fit-section {
    display: table;
    width: min(68rem, 100%);
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.submission-info pre.raw-json {
    box-sizing: border-box;
    width: min(68rem, 100%);
    max-height: none;
    margin-left: auto;
    margin-right: auto;
    overflow: visible;
    overflow-x: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.8rem;
    border: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-code-background-color);
    padding: 0.65rem 0.8rem;
}
.submission-info pre.raw-json code {
    max-height: none;
    overflow-y: visible;
}
.submission-info details {
    width: min(68rem, 100%);
    margin-top: 0.75rem;
    margin-left: auto;
    margin-right: auto;
}
.submission-info details > summary {
    width: fit-content;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Wrapped text blocks for dump log, comments, etc. */
.section-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    background: var(--pico-code-background-color);
    padding: 0.75rem;
    border-radius: 4px;
}
body:has(.submission-info) main.container > section {
    margin: 0.6rem 0;
    padding: 0.55rem 0;
    border-top: var(--pico-border-width) solid var(--pico-form-element-border-color);
    border-bottom: var(--pico-border-width) solid var(--pico-form-element-border-color);
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(127, 145, 164, 0.04) 1.5rem,
        rgba(127, 145, 164, 0.04) calc(100% - 1.5rem),
        transparent 100%
    );
}
[data-theme="dark"] body:has(.submission-info) main.container > section {
    background: linear-gradient(
        90deg,
        transparent 0,
        rgba(15, 20, 28, 0.55) 1.5rem,
        rgba(15, 20, 28, 0.55) calc(100% - 1.5rem),
        transparent 100%
    );
}
body:has(.submission-info) main.container > section h3,
body:has(.submission-info) main.container > section .section-text {
    width: min(68rem, 100%);
    margin-left: auto;
    margin-right: auto;
}
body:has(.submission-info) main.container > section h3 {
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Review action buttons */
.review-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: flex-end;
}
.review-actions .btn-approve {
    background-color: #388e3c;
    border-color: #388e3c;
}
.review-actions .btn-reject {
    background-color: #c62828;
    border-color: #c62828;
}

/* ===== Dark mode overrides ===== */
[data-theme="dark"],
[data-theme="dark"] body {
    --pico-background-color: #0C0E12;
    --pico-card-background-color: #14181E;
    --pico-card-sectioning-background-color: #181C24;
    --pico-form-element-background-color: #14181E;
    --pico-code-background-color: #14181E;
    --pico-muted-border-color: #2B3645;
    --pico-color: #EDECEF;
    --pico-muted-color: #B8C0CC;
    background: #0C0E12;
    color: #EDECEF;
}
[data-theme="dark"] a {
    color: #CDE6F3;
}
[data-theme="dark"] a:hover {
    color: #DDEFF7;
}
[data-theme="dark"] .validation-result a,
[data-theme="dark"] .validation-result a:hover {
    color: #035c90;
}
/* Headers and More... match h3 heading color in dark mode */
[data-theme="dark"] .recent-dumps th {
    color: #C8CED8;
}
[data-theme="dark"] .home-recent-dumps p a,
[data-theme="dark"] .home-recent-changes p a {
    color: #C8CED8;
}
[data-theme="dark"] .recent-dumps td,
[data-theme="dark"] table.striped tbody tr td,
[data-theme="dark"] .disc-view table td {
    background-color: #14181E !important;
}
/* Alternating rows — home page and striped tables */
[data-theme="dark"] .recent-dumps tbody tr:nth-child(odd) td,
[data-theme="dark"] .disc-view table tbody tr:nth-child(odd) td,
[data-theme="dark"] table.striped tbody tr:nth-child(odd) td {
    background-color: transparent !important;
}
[data-theme="dark"] .clickable-row:hover td,
[data-theme="dark"] .clickable-row.is-row-hover td {
    background-color: #212B38 !important;
}
[data-theme="dark"] .clickable-row:focus-visible td {
    background-color: #212B38 !important;
    box-shadow: inset 0 1px 0 #506176, inset 0 -1px 0 #506176;
}
