*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f5f7fa; color: #333; line-height: 1.6; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.header { background: #1e293b; color: #fff; padding: 1rem 0; }
.header-inner { max-width: 960px; margin: 0 auto; padding: 0 1rem; display: flex; justify-content: space-between; align-items: center; }
.header h1 { font-size: 1.2rem; font-weight: 600; }
.header h1 a { color: #fff; }
.header h1 a:hover { text-decoration: none; }
.header nav a { color: #94a3b8; margin-left: 1.5rem; font-size: 0.9rem; }
.header nav a:hover { color: #fff; }

.container { max-width: 960px; margin: 0 auto; padding: 2rem 1rem; }

.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #1e293b; }

.btn { display: inline-block; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.9rem; font-weight: 500; border: none; cursor: pointer; text-align: center; }
.btn:hover { text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.9rem; color: #475569; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="file"],
.form-group select,
.form-group textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; font-family: inherit; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .help { font-size: 0.8rem; color: #6b7280; margin-top: 0.25rem; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 0.9rem; }
th { font-weight: 600; color: #475569; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-orange { background: #fff7ed; color: #9a3412; }

.empty-state { text-align: center; padding: 3rem 1rem; color: #6b7280; }
.empty-state p { margin-bottom: 1rem; }

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.image-card { position: relative; border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; }
.image-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.image-card .image-actions { padding: 0.5rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; }

.version-list { list-style: none; }
.version-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #f1f5f9; }
.version-list li:last-child { border-bottom: none; }

.debug-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }
.debug-box strong { color: #92400e; }
.debug-box code { background: #fef3c7; padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.85rem; word-break: break-all; }

.actions { display: flex; gap: 0.5rem; align-items: center; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { background: #f1f5f9; }
.sort-arrow::after { content: '\2195'; color: #94a3b8; font-size: 0.75rem; margin-left: 0.25rem; }
.sortable.asc .sort-arrow::after { content: '\2191'; color: #1e293b; }
.sortable.desc .sort-arrow::after { content: '\2193'; color: #1e293b; }

.nav-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 0.4rem;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    margin: 4px 0;
    border-radius: 1px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; gap: 0.25rem; }
    .nav-toggle { display: block; }
    .header nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
        padding: 0.5rem 0;
    }
    .header nav.open { display: flex; }
    .header nav a { margin-left: 0; }
    .user-switcher { margin-left: 0; }
    .user-switcher select { width: 100%; }
}

/* ─── Layout helpers ──────────────────────────────────────────────────────── */

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.3rem; color: #1e293b; }

.card-narrow { max-width: 520px; }
.card-login { max-width: 520px; margin: 2rem auto; }
.table-card { padding: 0; overflow: hidden; }

.back-link { margin-bottom: 1.5rem; }

/* ─── Text helpers ────────────────────────────────────────────────────────── */

.muted { color: #6b7280; }
.muted-sm { color: #6b7280; font-size: 0.9rem; }
.muted-xs { color: #6b7280; font-size: 0.8rem; }
.text-emphasis { color: #1e293b; }
.nowrap { white-space: nowrap; }

.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 1.5rem; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */

.form-inline { display: inline; }
.btn-block { width: 100%; }

.filter-input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.95rem; }
.filter-row { margin-bottom: 1rem; }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.25rem; }
.checkbox-row label { display: flex; align-items: center; gap: 0.3rem; font-weight: normal; cursor: pointer; }

.form-footer { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; color: #6b7280; }
.label-hint { color: #6b7280; font-weight: normal; }

/* ─── Login / signup marketing pane ───────────────────────────────────────── */

.features-list {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding-left: 1.25rem;
    list-style: disc;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.hr-divider { border: none; border-top: 1px solid #e2e8f0; margin-bottom: 1.5rem; }
.login-heading { font-size: 1rem; color: #1e293b; margin-bottom: 0.5rem; }

.turnstile-wrapper { margin-bottom: 1rem; display: flex; justify-content: center; }

/* ─── Banners ─────────────────────────────────────────────────────────────── */

.banner-impersonate { margin: 0; border-radius: 0; text-align: center; }
.banner-impersonate form { margin-left: 0.5rem; }

.user-switcher { display: inline-block; margin-left: 1.5rem; }
.user-switcher select {
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}
.user-switcher select:hover { background: #1e293b; }

/* ─── Doc lists in extension-form help ────────────────────────────────────── */

.disc-list { list-style: disc; padding-left: 1.5rem; }

/* ─── Version list timestamp ──────────────────────────────────────────────── */

.version-list .timestamp { color: #6b7280; font-size: 0.8rem; margin-left: 0.5rem; }

/* ─── Admin table helpers ─────────────────────────────────────────────────── */

.dev-email-sub { color: #6b7280; font-size: 0.8rem; }

/* ─── Release notes ───────────────────────────────────────────────────────── */

.release-notes-list { list-style: none; }
.release-notes-list > li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.release-notes-list > li:last-child { border-bottom: none; }
.release-note-form { flex: 1; }
.release-note-actions { display: flex; align-items: center; gap: 0.75rem; }
.release-note-actions .timestamp { color: #6b7280; font-size: 0.8rem; }
.release-note-delete { margin-top: 1.6rem; }
