/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

[hidden] {
    display: none !important;
}

:root {
    --bg: #ffffff;
    --text: #1c1c1e;
    --muted: #6e6e73;
    --border: #d1d1d6;
    --accent: #0071e3;

    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;

    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;

    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;

    --info: #0284c7;
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;
    --max-w: 768px;
    --radius: 8px;
    --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg) url('/images/ts-bg-v1.png') center center / cover fixed;
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

.ghost:not(:hover):not(:focus):not(:active) {
    border-color: transparent !important;
    background-color: transparent !important;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.8125rem;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.nowrap {
    white-space: nowrap;
}

.flex-1 {
    flex: 1;
}

.items-start {
    align-items: flex-start;
}

.hand {
    cursor: pointer;
}

.off, [disabled], .disabled, *:disabled {
    opacity: 0.35;
    cursor: not-allowed !important;
    pointer-events: none !important;
    user-select: none !important;
    touch-action: none !important;
}

/* Flex layout utilities */
.h-stack {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.h-stack-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.h-stack-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.h-stack-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.v-stack {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Hint / helper text */
.hint {
    display: block;
    font-size: 0.8125rem;
    color: var(--muted);
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--muted);
}

/* Language code input */
.lang-code-input {
    width: 6rem;
    font-family: monospace;
}

.font-normal {
    font-weight: 400;
}

.mr-auto {
    margin-right: auto;
}

.mb-0 {
    margin-bottom: 0;
}

.mt-3 {
    margin-top: 0.75rem;
}

.d-inline {
    display: inline;
}

.text-xxs {
    font-size: 0.75rem;
}

.align-self-center {
    align-self: center;
}

/* ===========================
   Layout
   =========================== */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===========================
   Admin Bar (public page)
   =========================== */
.admin-bar {
    background: #1c1c1e;
    color: #ffffffcc;
    font-size: 0.8125rem;
    padding: 0.4rem 0;
}

.admin-bar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-bar .container > div {
    display: flex;
    gap: 1.25rem;
}

.admin-bar a {
    color: #fff;
    text-decoration: none;
    opacity: 0.8;
}

.admin-bar a:hover {
    opacity: 1;
}

/* ===========================
   Public Site
   =========================== */
.site {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    max-width: var(--max-w);
    margin: 2vw auto;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 40px -8px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
}

.site-header {
    padding: 0.5rem;
    background: url('/images/u2f-banner-sm.png') center top / cover no-repeat;
    /*min-height: 300px;*/
    height: 300px;
    display: flex;
    align-items: flex-end;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    max-height: 40vw;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    pointer-events: none;
    user-select: none;
}

.site-tagline {
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 1rem;
}

.site-nav {
    display: flex;
    gap: 0.125rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.site-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.site-nav-link:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.site-nav-active {
    color: var(--text);
    font-weight: 600;
}

.site-nav-search {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.site-nav-search input[type="search"] {
    font-size: 0.8125rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    width: 10rem;
    outline: none;
}

.site-nav-search input[type="search"]:focus {
    border-color: var(--muted);
    width: 14rem;
    transition: width 0.2s;
}

.page-listing-query {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.site-main {
    flex: 1;
    padding: 0 0 2.5rem 0;
}

.site-topbar {
    display: flex;
    justify-content: flex-end;
    padding: 0.35rem 1.5rem;
    margin-bottom: 0;
}

.content-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.content-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.content-section h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.section-body {
    color: var(--muted);
    font-size: 0.9375rem;
}

.lang-switcher {
    display: flex;
    gap: 0.25rem;
    padding-top: 0.25rem;
    flex-shrink: 0;
}

.lang-btn {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
    text-decoration: none;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
}

.lang-btn:hover {
    background: #f0f0f2;
    color: var(--text);
}

.lang-active {
    background: #f0f0f2;
    color: var(--text);
    cursor: default;
}

.site-footer {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.875rem;
}

/* ===========================
   Form Elements
   =========================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group + .form-group {
    margin-top: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.3rem;
    letter-spacing: 0.05em;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font), sans-serif;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

select {
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: var(--font), sans-serif;
    line-height: 1;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

textarea.auto-height {
    resize: none;
    overflow-y: auto;
    max-height: 90vh;
}

.url-preview {
    margin-top: 0.4rem;
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
    color: var(--muted);
}

.url-preview-origin {
    opacity: 0.6;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    line-height: 1;
}

.btn:hover {
    background: color-mix(in srgb, #fff 88%, black);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--accent) 85%, black);
    border-color: color-mix(in srgb, var(--accent) 85%, black);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: color-mix(in srgb, #fff 88%, black);
    border-color: var(--border);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--danger-bg) 85%, var(--danger));
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8125rem;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.select-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
}

.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
    margin-left: -1px;
}

.btn-group .btn:first-child {
    border-radius: 6px 0 0 6px;
    margin-left: 0;
}

.btn-group .btn:last-child {
    border-radius: 0 6px 6px 0;
}

.btn-group .btn:hover,
.btn-group .btn:focus-visible {
    position: relative;
    z-index: 1;
}

.btn-group span.btn {
    background: #f5f5f7;
    color: var(--text);
}

/* ===========================
   Flash Message
   =========================== */
.alert {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
}

/* ===========================
   Admin - Login
   =========================== */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f7;
}

.login-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 360px;
}

.login-box h1 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* ===========================
   Admin - Dashboard
   =========================== */
.admin-layout {
    min-height: 100vh;
    background: #f5f5f7;
}

.admin-topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-nav {
    display: flex;
    gap: 0.25rem;
}

.admin-nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.admin-nav-link:hover {
    background: #f5f5f7;
    color: var(--text);
}

.admin-nav-link.active {
    background: #f5f5f7;
    color: var(--text);
    font-weight: 600;
}

.admin-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-username {
    font-size: 0.875rem;
    color: var(--muted);
}

.admin-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: auto;
}

.admin-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.admin-menu-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.admin-menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.admin-menu-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
    .admin-topbar {
        position: relative;
    }

    .admin-menu-toggle {
        display: flex;
    }

    .admin-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        background: #fff;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1.5rem 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        z-index: 10;
    }

    .admin-menu.open {
        display: flex;
    }

    .admin-nav {
        flex-direction: column;
        align-items: flex-start;
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .admin-topbar-right {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.admin-content {
    max-width: 780px;
    margin: 2rem auto;
    padding: 0 1.5rem 3rem;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card + .card {
    margin-top: 1.25rem;
}

/* card-title modifier: no bottom border (e.g. when content below is a list) */
.card-title-flush {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* card-title inline annotation: resets title-ish styling on child spans */
.card-title-note {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-card {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.section-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ===========================
   Admin - Version History
   =========================== */
.versions-summary {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

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

.versions-summary::before {
    content: '▶';
    display: inline-block;
    font-size: 0.6rem;
    margin-right: 0.5rem;
    transition: transform 0.15s;
}

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

.version-list {
    margin-top: 0.75rem;
}

.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.version-ts {
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
}

/* ===========================
   Admin - Compare
   =========================== */
.compare-columns-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.compare-col-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.compare-section {
    margin-bottom: 1rem;
}

.compare-lang-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

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

.compare-textarea {
    width: 100%;
    min-height: 180px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--text);
    background: #fafafa;
    resize: vertical;
    outline: none;
}

.compare-same {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--muted);
    background: #fafafa;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===========================
   Admin - Page List
   =========================== */
/* ===========================
   Admin - Navigation editor
   =========================== */
.nav-list-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-left: 1.5rem;
}

.nav-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.nav-item.dragging {
    opacity: 0.4;
}

.nav-input {
    flex: 1;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.nav-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.nav-input-url {
    flex: 2;
    font-family: ui-monospace, monospace;
    font-size: 0.8125rem;
}

/* Replacements table */
.replacements-table {
    width: 100%;
    border-collapse: collapse;
}

.replacements-table thead tr {
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: left;
}

.replacements-table thead th:first-child {
    padding: 0.25rem 0.5rem 0.5rem 0;
    width: 50%;
}

.replacements-table thead th:last-child {
    padding: 0.25rem 0 0.5rem;
    width: 50%;
}

.replacements-table tbody tr:first-child td:first-child {
    padding: 0.25rem 0.5rem 0.125rem 0;
}

.replacements-table tbody tr:first-child td:last-child {
    padding: 0.25rem 0 0.125rem 0.5rem;
}

.replacements-table tbody + tbody tr:first-child td {
    padding-top: 0.75rem;
}

.replacements-table tbody tr:last-child td:first-child {
    padding: 0.125rem 0.5rem 0.375rem 0;
}

.replacements-table tbody tr:last-child td:last-child {
    padding: 0.125rem 0 0.375rem 0.5rem;
}

.sort-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.sort-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-right: 0.25rem;
}

.sort-btn {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
}

.sort-btn:hover {
    background: #f0f0f2;
    color: var(--text);
}

.sort-active {
    background: #f0f0f2;
    color: var(--text);
    font-weight: 600;
    cursor: default;
}

.page-list {
    margin-top: 1rem;
}

.page-item {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    cursor: default;
}

.page-item.dragging {
    opacity: 0.4;
}

.drag-handle {
    color: var(--border);
    cursor: grab;
    font-size: 1.1rem;
    padding-top: 0.1rem;
    flex-shrink: 0;
    user-select: none;
    transition: color 0.15s;
}

.drag-handle:hover {
    color: var(--muted);
}

.page-item:first-child {
    border-top: none;
    padding-top: 0;
}

.page-item-body {
    flex: 1;
    min-width: 0;
}

.page-slug {
    font-family: ui-monospace, monospace;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
}

.page-slug a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.page-slug a:hover {
    border-bottom-color: var(--text);
}

.page-excerpt {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 0.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-meta {
    margin-top: 0.25rem;
}

.page-meta-item {
    font-size: 0.75rem;
    color: var(--muted);
}

/* ===========================
   Tabs
   =========================== */
.tabs {
    margin-bottom: 1rem;
}

.tab-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    font-family: var(--font);
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.checkbox-label {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label + .checkbox-label {
    margin-top: 0.5rem;
}

/* ===========================
   User badges
   =========================== */
.user-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-superuser {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid var(--info-border);
}

.badge-developer {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-success {
    color: var(--success);
}

.text-info {
    color: var(--info);
}

.text-muted {
    color: var(--muted);
}

.page-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
    padding-top: 0.1rem;
}


.page-body {

}

/* ===========================
   Homepage listing
   =========================== */
.homepage-banner {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.page-listing {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.page-listing-empty {
    color: var(--muted);
    font-size: 0.9375rem;
}

.listing-item {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.listing-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.listing-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.listing-title a {
    color: var(--text);
    text-decoration: none;
}

.listing-title a:hover {
    color: var(--accent);
}

.listing-meta {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.listing-excerpt {
    font-size: 0.9375rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

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

.page-body img {
    display: block;
    max-width: 100%;
    margin: 0.5rem auto;
    border-radius: 6px;
}

img {
    max-width: 100% !important;
}

.markdown p {
    margin: 0.5rem 0 1.25rem 0;
}

.markdown ul,
.markdown ol {
    margin: 0.5rem 0 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.markdown ul {
    list-style: disc;
}

.markdown ol {
    list-style: decimal;
}

.markdown li > ul,
.markdown li > ol {
    margin-top: 0.3rem;
    margin-bottom: 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
    margin: 0.25rem 0 0.5rem 0;
    line-height: 1.3;
}

.markdown h1 {
    font-size: 1.5rem;
}

.markdown h2 {
    font-size: 1.25rem;
}

.markdown h3 {
    font-size: 1.0625rem;
}

.markdown h4 {
    font-size: 0.9375rem;
}

.markdown strong {
    font-weight: 600;
}

.markdown em {
    font-style: italic;
}

.markdown a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 113, 227, 0.3);
}

.markdown a:hover {
    border-bottom-color: var(--accent);
}

.markdown code {
    font-family: ui-monospace, monospace;
    font-size: 0.875em;
    background: #f0f0f2;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.markdown pre {
    background: #f0f0f2;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.5rem 0 1.25rem 0;
}

.markdown pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
}

.markdown blockquote {
    border-left: 4px solid var(--border);
    margin: 0.5rem 0 1.25rem 0;
    padding: 0.1rem 0 0.1rem 0.5rem;
    color: var(--muted);
    background-color: rgba(255, 255, 255, 0.9);
}

.markdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ===========================
   Upload drop zone & queue
   =========================== */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 6px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.drop-label {
    font-size: 0.875rem;
    color: var(--muted);
    pointer-events: none;
}

.drop-trigger {
    color: var(--accent);
    text-decoration: underline;
}

.upload-queue {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.upload-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.upload-filename {
    color: var(--muted);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.row-status {
    white-space: nowrap;
    color: var(--muted);
}

/* ===========================
   Image upload grid
   =========================== */
.upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.upload-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.upload-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    width: 100%;
    display: block;
    background: #f5f5f7;
    max-width: 100%;
}

.upload-info {
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.upload-name {
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 0.2rem;
}

.upload-size {
    margin-bottom: 0.4rem;
}

.upload-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* === Snippet inline inputs === */
.snippet-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.snippet-body {
    font-size: 0.875rem;
    resize: none;
}

.snippet-variant {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.snippet-variant:first-of-type {
    margin-top: 0.25rem;
    padding-top: 0;
    border-top: none;
}

.snippet-variant-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.snippet-label {
    font-weight: 600;
    color: var(--muted);
}

.snippet-variant-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.snippet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* === Modal (dialog) === */
dialog.modal {
    border: none;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    width: 440px;
    max-width: 94vw;
    max-height: 68vh;
    padding: 0;
    overflow: hidden;
    margin: auto;
}

dialog.modal[open] {
    display: flex;
    flex-direction: column;
}

dialog.modal::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

@media all and (max-width: 600px) {
    .site {
        margin-top: 0;
    }

    .site-header {
        border-radius: 0;
    }
}