:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #17202a;
    --muted: #637083;
    --line: #dde4ee;
    --primary: #1f7a5c;
    --primary-strong: #165f47;
    --danger: #b42318;
    --warn: #b76e00;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, "Microsoft YaHei", sans-serif;
}

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

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 14px;
    cursor: pointer;
    font: inherit;
}

button.primary,
.button.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.button.small {
    min-height: 32px;
    padding: 0 10px;
}

button.primary:hover,
.button.primary:hover {
    background: var(--primary-strong);
}

button.danger {
    border-color: #f2c6c2;
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 10px 11px;
    font: inherit;
}

textarea {
    resize: vertical;
}

label,
.field-label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 14px;
}

.field-caption {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 230px;
    background: #10231d;
    color: #eaf6f1;
    padding: 24px 16px;
}

.brand {
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 28px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar a {
    border-radius: 6px;
    color: #cfe5dc;
    padding: 11px 12px;
}

.sidebar a.active,
.sidebar a:hover {
    background: #1f4c3d;
    color: #fff;
}

.logout {
    position: absolute;
    right: 16px;
    bottom: 18px;
    left: 16px;
}

.logout button {
    width: 100%;
    background: transparent;
    color: #cfe5dc;
}

.main {
    margin-left: 230px;
    padding: 32px;
}

.auth-main {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 28px;
    box-shadow: 0 20px 60px rgba(17, 24, 39, .12);
}

.login-card h1,
.page-head h1 {
    margin: 0 0 8px;
}

.login-card p,
.page-head p {
    margin: 0;
    color: var(--muted);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.panel,
.stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 18px;
}

.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.stat {
    display: grid;
    gap: 12px;
}

.stat span {
    color: var(--muted);
}

.stat strong {
    font-size: 30px;
}

.stack {
    display: grid;
    gap: 16px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 180px auto;
    gap: 10px;
    margin-bottom: 16px;
}

.editor-grid,
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}

.split {
    grid-template-columns: 330px minmax(0, 1fr);
}

.check-list {
    display: grid;
    gap: 8px;
}

.check-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
}

.check-list input {
    width: auto;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge.published {
    background: #dcfce7;
    color: #166534;
}

.badge.draft {
    background: #fff7ed;
    color: var(--warn);
}

.row-actions {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.row-actions form {
    margin: 0;
}

.inline-form {
    display: grid;
    width: 280px;
    gap: 8px;
    margin-top: 10px;
}

.alert {
    border-radius: 6px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.empty,
.muted {
    color: var(--muted);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 18px clamp(20px, 5vw, 64px);
}

.site-brand {
    color: var(--ink);
    font-size: 21px;
    font-weight: 800;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.site-main {
    width: min(980px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 64px;
}

.site-hero {
    margin-bottom: 24px;
}

.site-hero h1 {
    margin: 0 0 8px;
    font-size: 34px;
}

.site-hero p {
    margin: 0;
    color: var(--muted);
}

.site-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 220px auto;
    gap: 10px;
    margin-bottom: 20px;
}

.post-list {
    display: grid;
    gap: 16px;
}

.post-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 22px;
}

.post-card h2 {
    margin: 8px 0 10px;
    font-size: 22px;
}

.post-card h2 a {
    color: var(--ink);
}

.post-card p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.7;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    color: var(--muted);
    font-size: 13px;
}

.read-link,
.back-link {
    font-weight: 700;
}

.article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: clamp(24px, 5vw, 44px);
}

.article h1 {
    margin: 16px 0 12px;
    font-size: clamp(28px, 5vw, 42px);
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.breadcrumb span::before {
    content: "/";
    margin-right: 8px;
}

.article-cover {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 22px;
}

.article-excerpt {
    border-left: 4px solid var(--primary);
    color: var(--muted);
    font-size: 18px;
    line-height: 1.8;
    margin: 24px 0;
    padding-left: 16px;
}

.article-body {
    line-height: 1.9;
    margin-top: 24px;
    white-space: normal;
}

.article-body h2,
.article-body h3 {
    margin: 28px 0 10px;
}

.article-body p {
    margin: 0 0 16px;
}

.article-toc {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafcff;
    margin: 22px 0;
    padding: 16px 18px;
}

.article-toc ol {
    margin: 10px 0 0;
    padding-left: 22px;
}

.help-details {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfdff;
    color: var(--muted);
    padding: 9px 11px;
}

.help-details.inline-help {
    display: inline-block;
    position: relative;
    border: 0;
    background: transparent;
    padding: 0;
    line-height: 1;
}

.help-details summary {
    color: var(--primary);
    cursor: pointer;
    font-weight: 700;
}

.help-details.inline-help summary {
    display: inline-flex;
    align-items: center;
    list-style: revert;
    min-width: 14px;
}

.help-details.inline-help p,
.help-details.inline-help code {
    display: block;
    border: 1px solid var(--line);
    background: #fbfdff;
    padding: 9px 11px;
    width: min(520px, calc(100vw - 80px));
    line-height: 1.7;
}

.help-details p {
    margin: 8px 0;
    line-height: 1.7;
}

.help-details code,
.seo-help-table code {
    white-space: normal;
    overflow-wrap: anywhere;
}

.seo-help-table {
    margin-top: 18px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.tag-row span {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    padding: 5px 10px;
}

.template-preview {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafcff;
    padding: 18px;
}

.template-preview h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.row-actions button {
    min-height: 32px;
    padding: 0 10px;
}

.site-empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .logout {
        position: static;
        margin-top: 20px;
    }

    .main {
        margin-left: 0;
        padding: 20px;
    }

    .stats,
    .filters,
    .site-filters,
    .editor-grid,
    .split {
        grid-template-columns: 1fr;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    table {
        min-width: 720px;
    }

    .panel {
        overflow-x: auto;
    }
}
