/* bbsfiles.org — base styles */

/* ── CP437 Font ─────────────────────────────────────── */
@font-face {
    font-family: 'Perfect DOS VGA 437';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/PerfectDOSVGA437.woff') format('woff');
}

.cp437 {
    font-family: 'Perfect DOS VGA 437', 'Courier New', monospace;
    line-height: 1.35;
}

:root {
    --bg: #0a0a0a;
    --fg: #cccccc;
    --accent: #00aaff;
    --accent-dim: #0077cc;
    --border: #333;
    --surface: #111;
}

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

body {
    font-family: 'Courier New', Courier, monospace;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
    width: 100%;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}

.site-header nav {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--accent);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: #666;
}

/* Hero */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}

.hero h1 {
    color: var(--accent);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Archive list */
.archive-list h2 {
    margin-bottom: 1rem;
    color: var(--fg);
}

.archive-list ul {
    list-style: none;
}

.archive-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.badge {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    color: #888;
    margin-left: 0.5rem;
}

.year {
    color: #666;
    font-size: 0.85rem;
}

.empty-state {
    color: #666;
    font-style: italic;
    padding: 2rem 0;
}

/* Login form */
.login-form {
    max-width: 360px;
    margin: 3rem auto;
}

.login-form h1 {
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.login-form label {
    display: block;
    margin-bottom: 0.3rem;
    color: #888;
    font-size: 0.9rem;
}

.login-form input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--fg);
    font-family: inherit;
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-form button {
    width: 100%;
    padding: 0.6rem;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.login-form button:hover {
    background: var(--accent);
}

.error {
    color: #ff4444;
    margin-bottom: 1rem;
}

/* Admin dashboard */
.admin-dashboard h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.stats {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
    flex: 1;
}

.stat-number {
    display: block;
    font-size: 2rem;
    color: var(--accent);
    font-weight: bold;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
}

.admin-nav {
    margin-top: 2rem;
}

.admin-nav h2 {
    margin-bottom: 0.5rem;
}

.admin-nav ul {
    list-style: none;
}

.admin-nav li {
    padding: 0.4rem 0;
}

/* Activity log */
.activity-log {
    margin-top: 2rem;
}

.activity-log h2 {
    margin-bottom: 0.5rem;
}

.activity-table {
    table-layout: auto;
}

.activity-table th:nth-child(1) { width: 160px; }
.activity-table th:nth-child(2) { width: 100px; }
.activity-table th:nth-child(3) { width: 80px; }
.activity-table th:nth-child(4) { width: auto; }

.activity-table td:nth-child(1) {
    white-space: nowrap;
    color: #888;
    font-size: 0.85rem;
}

/* Ingest wizard */
.ingest-wizard h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.ingest-info {
    color: #888;
    margin-bottom: 0.5rem;
}

.ingest-info code {
    color: var(--fg);
    background: var(--surface);
    padding: 0.1rem 0.4rem;
}

/* File table */
.file-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    table-layout: fixed;
}

.file-table th,
.file-table td {
    text-align: left;
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.file-table th {
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.8rem;
}

.file-table th:nth-child(1) { width: auto; }
.file-table th:nth-child(2) { width: 100px; text-align: right; }
.file-table th:nth-child(3) { width: 160px; }
.file-table th:nth-child(4) { width: 100px; text-align: center; }

.file-table td:nth-child(2) {
    white-space: nowrap;
    color: #888;
    text-align: right;
}

.file-table td:nth-child(3) {
    white-space: nowrap;
    color: #888;
}

.file-table td:nth-child(4) {
    text-align: center;
}

.muted {
    color: #555;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: var(--accent);
    text-decoration: none;
}

.btn-small {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

/* Ingest process form */
.ingest-process h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.file-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.file-summary table {
    border-collapse: collapse;
}

.file-summary th {
    text-align: right;
    padding-right: 1.25rem;
    padding-bottom: 0.3rem;
    color: #888;
    white-space: nowrap;
    font-weight: normal;
}

.file-summary td {
    padding-bottom: 0.3rem;
}

.file-summary .hash {
    font-size: 0.75rem;
    word-break: break-all;
    color: #888;
}

/* Ingest form */
.ingest-form {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.ingest-form h2 {
    margin-bottom: 1rem;
}

.ingest-form form {
    max-width: 100%;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #888;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: #1a1a2e;
    border: 1px solid var(--border);
    color: var(--accent);
    font-family: inherit;
    font-size: 1.05rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group select {
    appearance: auto;
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 1.5rem;
}

.form-row .form-group {
    flex: 1;
}

.form-row .form-group-small {
    flex: 0 0 120px;
}

.ingest-form .btn-ingest {
    margin-top: 1rem;
    padding: 0.8rem 2rem;
    font-size: 1.15rem;
    width: 100%;
}

/* Contents listing */
.contents-listing {
    margin-top: 2rem;
}

.contents-listing h2 {
    margin-bottom: 0.5rem;
}

.contents-table {
    table-layout: auto;
}

.contents-table th:nth-child(1) { width: auto; }
.contents-table th:nth-child(2) { width: 90px; text-align: right; }
.contents-table th:nth-child(3) { width: 100px; }
.contents-table th:nth-child(4) { width: 160px; }
.contents-table th:nth-child(5) { width: 80px; text-align: center; }

.contents-table td:nth-child(2) {
    text-align: right;
}

.contents-table td:nth-child(3) {
    white-space: nowrap;
    color: #888;
}

.contents-table td:nth-child(5) {
    text-align: center;
}

.contents-table .hash {
    font-size: 0.75rem;
    color: #666;
    font-family: inherit;
}

.row-dupe {
    background: rgba(255, 170, 0, 0.05);
}

.badge-dupe {
    background: #332200;
    border-color: #aa6600;
    color: #ffaa00;
    cursor: pointer;
}

a.badge-dupe:hover {
    text-decoration: none;
    background: #443300;
    color: #ffcc44;
}

.badge-new {
    background: #002211;
    border-color: #2a6;
    color: #4d8;
}

.dupe-warning {
    color: #ffaa00;
    margin-bottom: 0.75rem;
}

.dupe-archive-warning {
    background: #2a1a00;
    border: 2px solid #cc7700;
    padding: 1rem 1.25rem;
    margin: 1rem 0 1.5rem;
    color: #ffcc44;
}

.dupe-archive-warning a {
    color: #ffaa00;
    text-decoration: underline;
}

.dupe-archive-warning a:hover {
    color: #fff;
}

/* Success box */
.success-box {
    background: #0a1a0a;
    border: 1px solid #2a6;
    padding: 1.5rem;
    margin: 1.5rem 0;
    color: #4d8;
}

.success-box p {
    margin-bottom: 0.75rem;
}

.success-box .btn {
    margin-top: 0.5rem;
}

/* Debug (collapsible) */
.debug-box {
    background: #1a1a00;
    border: 1px solid #665500;
    margin: 1rem 0;
    font-size: 0.8rem;
}

.debug-box summary {
    padding: 0.5rem 1rem;
    color: #997700;
    cursor: pointer;
    user-select: none;
}

.debug-box summary:hover {
    color: #ccaa00;
}

.debug-content {
    padding: 0.75rem 1rem;
    margin: 0;
    color: #ccaa00;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.6;
    border-top: 1px solid #665500;
}

/* FILE_ID.DIZ */
.file-id-diz {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.file-id-diz h3 {
    color: #888;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.file-id-diz pre {
    margin: 0;
    white-space: pre;
    line-height: 1.3;
    font-size: 0.9rem;
    overflow-x: auto;
}

/* Category row with + Sub button */
.category-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-row select {
    flex: 1;
}

.subcategory-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.subcategory-inline input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--fg);
    font-family: inherit;
    font-size: 0.9rem;
}

.subcategory-inline input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-cancel {
    background: transparent;
    border-color: var(--border);
    color: #888;
}

.btn-cancel:hover {
    background: var(--surface);
    color: var(--fg);
}

/* Text preview */
.text-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre;
    tab-size: 8;
    counter-reset: line;
}

.text-preview.has-lines {
    padding: 1rem 1rem 1rem 0;
}

.text-preview.has-lines > code {
    display: block;
    counter-increment: line;
    white-space: pre;
    padding-left: 0.75rem;
}

.text-preview.has-lines > code::before {
    content: counter(line);
    display: inline-block;
    width: 3.5em;
    text-align: right;
    padding-right: 0.75em;
    margin-right: 0.75em;
    border-right: 1px solid var(--border);
    color: #555;
    user-select: none;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    background: var(--bg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.95rem;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal .text-preview {
    flex: 1;
    overflow: auto;
    border: none;
    margin: 0;
}

/* Tag input */
.tag-input-wrap {
    position: relative;
}

.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border: 1px solid var(--border);
    border-top: none;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.tag-dropdown[hidden] {
    display: none;
}

.tag-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.95rem;
}

.tag-dropdown-item:hover {
    background: var(--accent-dim);
    color: #fff;
}

.tag-dropdown-new {
    color: #888;
    font-style: italic;
}

.tag-dropdown-new:hover {
    color: #fff;
}

/* Tag chips */
.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #1a1a2e;
    border: 1px solid var(--accent-dim);
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    color: var(--accent);
}

.tag-chip-remove {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

.tag-chip-remove:hover {
    color: #ff4444;
}

/* ── Homepage categories (tree) ──────────────────────── */
.home-categories {
    margin-bottom: 2rem;
}

.home-categories h2 {
    margin-bottom: 0.75rem;
    color: var(--fg);
}

.category-tree {
    list-style: none;
}

.cat-node {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.cat-node:last-child {
    border-bottom: none;
}

.cat-node > a {
    color: var(--accent);
}

.cat-node .count {
    color: #666;
    font-size: 0.85rem;
}

.cat-node details summary {
    cursor: pointer;
    list-style: none;
}

.cat-node details summary::before {
    content: '\25b6';
    display: inline-block;
    font-size: 0.65rem;
    margin-right: 0.4rem;
    color: #666;
    transition: transform 0.15s;
}

.cat-node details[open] summary::before {
    transform: rotate(90deg);
}

.cat-node details summary::-webkit-details-marker {
    display: none;
}

.cat-node details summary a {
    color: var(--accent);
}

.cat-children {
    list-style: none;
    padding-left: 1.2rem;
    margin-top: 0.2rem;
}

.cat-children li {
    padding: 0.15rem 0;
}

.cat-children a {
    color: var(--accent);
    font-size: 0.9rem;
}

/* ── Homepage tags ───────────────────────────────────── */
.home-tags {
    margin-bottom: 2rem;
}

.home-tags h2 {
    margin-bottom: 0.75rem;
    color: var(--fg);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-badge {
    display: inline-block;
    background: #1a1a2e;
    border: 1px solid var(--accent-dim);
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
    color: var(--accent);
}

.tag-badge:hover {
    background: var(--accent-dim);
    color: #fff;
    text-decoration: none;
}

.tag-badge .count {
    color: #666;
    font-size: 0.8rem;
    margin-left: 0.2rem;
}

/* ── Archive detail ──────────────────────────────────── */
.archive-detail {
    max-width: 960px;
}

.archive-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
}

.archive-header h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.archive-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 1.1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.dl-icon {
    width: 1.2em;
    height: 1.2em;
}

.file-dl-link {
    color: #666;
}

.file-dl-link:hover {
    color: var(--accent);
}

.dl-icon-sm {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

.archive-description {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.archive-tags {
    margin: 1.5rem 0;
}

.archive-tags h2 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--fg);
}

.archive-contents {
    margin-top: 2rem;
}

.archive-contents h2 {
    margin-bottom: 0.25rem;
    color: var(--fg);
}

.archive-contents .muted {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.text-indicator {
    color: #4d8;
    font-size: 0.8rem;
}

/* ── Breadcrumbs ────────────────────────────────────── */
.breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: #666;
}

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

.breadcrumb .sep {
    margin: 0 0.3rem;
    color: #444;
}

/* ── Browse page ────────────────────────────────────── */
.browse-page h1 {
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.browse-page > .muted {
    margin-bottom: 1.5rem;
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.category-card h2 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.category-card h2 a {
    color: var(--accent);
}

.category-card .category-desc {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.category-card .count {
    color: #666;
    font-size: 0.85rem;
}

.subcategory-links {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* ── Browse category page ───────────────────────────── */
.category-header {
    margin-bottom: 1.5rem;
}

.category-header h1 {
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.category-header .category-desc {
    color: #888;
    margin-bottom: 0.5rem;
}

.subcategory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

/* Archive table (browse category) */
.archive-table {
    table-layout: auto;
}

.archive-table th:nth-child(1) { width: auto; }
.archive-table th:nth-child(2) { width: 60px; }
.archive-table th:nth-child(3) { width: 60px; }
.archive-table th:nth-child(4) { width: 90px; white-space: nowrap; }
.archive-table th:nth-child(5) { width: auto; }

.archive-table td:nth-child(4) {
    white-space: nowrap;
}

.archive-table .year {
    font-size: inherit;
}

.archive-row-main td {
    border-bottom: none;
    padding-bottom: 0.2rem;
}

.archive-row-desc td {
    padding-top: 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.archive-desc-line {
    color: #888;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* ── Pagination ─────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.page-info {
    color: #666;
    font-size: 0.85rem;
}

/* ── Search page ────────────────────────────────────── */
.search-page h1 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.search-form {
    margin-bottom: 2rem;
}

.search-input-wrap {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    background: #1a1a2e;
    border: 1px solid var(--border);
    color: var(--accent);
    font-family: inherit;
    font-size: 1.05rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-results {
    margin-bottom: 2rem;
}

.search-results h2 {
    margin-bottom: 0.75rem;
    color: var(--fg);
}

.search-results h2 .count {
    color: #666;
    font-size: 0.85rem;
    font-weight: normal;
}

.search-snippet {
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
}

mark {
    background: rgba(0, 170, 255, 0.2);
    color: var(--accent);
    padding: 0 0.1rem;
}

/* ── File viewer ────────────────────────────────────── */
.file-viewer header {
    margin-bottom: 1.5rem;
}

.file-viewer header h1 {
    color: var(--accent);
    font-size: 1.3rem;
    margin-bottom: 0.3rem;
    word-break: break-all;
}

.file-meta {
    display: flex;
    gap: 1rem;
    color: #888;
    font-size: 0.85rem;
}

.file-meta .hash {
    font-size: 0.75rem;
    color: #666;
}

.ansi-render {
    margin-bottom: 1.5rem;
    text-align: center;
}

.ansi-image {
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
    border: 1px solid var(--border);
}

.raw-text-toggle {
    margin: 1rem 0;
}

.raw-text-toggle summary {
    cursor: pointer;
    color: #888;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.raw-text-toggle summary:hover {
    color: var(--fg);
}

.file-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ── Admin users ───────────────────────────────────── */
.admin-users h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.admin-users h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.admin-users-table {
    table-layout: auto;
}

.admin-users-table th:nth-child(1) { width: auto; }
.admin-users-table th:nth-child(2) { width: auto; }
.admin-users-table th:nth-child(3) { width: 160px; }

.admin-users-forms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .admin-users-forms {
        grid-template-columns: 1fr;
    }
}

.admin-users-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.admin-users-form-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* ── Upload form (ingest wizard) ───────────────────── */
.upload-form {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.upload-form h2 {
    margin-bottom: 1rem;
    color: var(--fg);
}

.upload-form form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    font-size: 1.1rem;
    cursor: pointer;
}

.btn-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.upload-filename {
    color: #888;
    font-size: 0.9rem;
}

.btn-upload-submit {
    padding: 0.7rem 2rem;
    font-size: 1.1rem;
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: #fff;
    font-family: inherit;
    cursor: pointer;
}

.btn-upload-submit:hover {
    background: var(--accent);
}

.upload-hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ── Admin archive search ──────────────────────────── */
.archive-search {
    margin-top: 2rem;
}

.archive-search h2 {
    margin-bottom: 0.5rem;
}

.archive-search-wrap {
    position: relative;
}

.archive-search-wrap input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: #1a1a2e;
    border: 1px solid var(--border);
    color: var(--accent);
    font-family: inherit;
    font-size: 1.05rem;
}

.archive-search-wrap input:focus {
    outline: none;
    border-color: var(--accent);
}

.archive-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border: 1px solid var(--border);
    border-top: none;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.archive-search-dropdown[hidden] {
    display: none;
}

.archive-search-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.95rem;
    text-decoration: none;
}

.archive-search-item:hover {
    background: var(--accent-dim);
    color: #fff;
    text-decoration: none;
}

.archive-search-item .search-meta {
    color: #666;
    font-size: 0.8rem;
    margin-left: 1rem;
    white-space: nowrap;
}

.archive-search-item:hover .search-meta {
    color: #aaa;
}

/* ── Archive edit ──────────────────────────────────── */
.archive-edit h1 {
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.archive-edit .success-box {
    margin: 1rem 0;
}

.archive-edit .form-group label input[type="checkbox"] {
    margin-right: 0.5rem;
}
