html,
body {
    height: 100%;
}

:root {
    --bg: #f4efe7;
    --bg-soft: #fffaf4;
    --panel: rgba(255, 252, 247, 0.92);
    --line: rgba(107, 81, 56, 0.18);
    --text: #2f2419;
    --muted: #7d6650;
    --accent: #c96b31;
    --accent-dark: #8d4217;
    --danger: #b24637;
    --success: #2c7c58;
    --shadow: 0 24px 60px rgba(94, 57, 25, 0.12);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(219, 157, 95, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(144, 94, 59, 0.18), transparent 28%),
        linear-gradient(180deg, #fbf6ef 0%, #f1e6d7 100%);
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.page-shell {
    display: block;
    height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 28px;
    background: rgba(63, 42, 22, 0.94);
    color: #fdf7ef;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    z-index: 10;
}

.brand {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 32px;
}

.brand h1 {
    margin: 0 0 4px;
    font-size: 22px;
}

.brand p {
    margin: 0;
    color: rgba(255, 247, 237, 0.7);
    font-size: 13px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 700;
    background: linear-gradient(135deg, #e8a562, #b4511f);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    padding: 14px 16px;
    border-radius: 14px;
    color: rgba(255, 247, 237, 0.78);
    background: rgba(255, 255, 255, 0.04);
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-footer {
    display: grid;
    gap: 16px;
}

.user-meta {
    display: grid;
    gap: 4px;
}

.user-meta span {
    color: rgba(255, 247, 237, 0.68);
    font-size: 13px;
}

.content {
    padding: 28px;
    margin-left: 280px;
    width: calc(100vw - 280px);
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

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

.page-head h2 {
    margin: 0 0 8px;
    font-size: 30px;
}

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

.grid {
    display: grid;
    gap: 18px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.card h3 {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 18px;
}

.metric {
    display: grid;
    gap: 10px;
}

.metric strong {
    font-size: 34px;
    line-height: 1;
}

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

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid;
}

.alert-success {
    background: rgba(44, 124, 88, 0.08);
    border-color: rgba(44, 124, 88, 0.24);
    color: var(--success);
}

.alert-error {
    background: rgba(178, 70, 55, 0.08);
    border-color: rgba(178, 70, 55, 0.24);
    color: var(--danger);
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    font-weight: 600;
}

.field small {
    color: var(--muted);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffdf9;
    color: var(--text);
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.actions form {
    margin: 0;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 11px 16px;
    cursor: pointer;
    background: var(--accent);
    color: #fffaf4;
}

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

.btn-secondary {
    background: #6a5b4c;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 247, 237, 0.2);
    color: #fffaf4;
}

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

.table-wrap {
    overflow: auto;
}

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

th,
td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid rgba(117, 92, 66, 0.14);
    vertical-align: top;
}

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

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.status-pending { background: rgba(201, 107, 49, 0.12); color: var(--accent-dark); }
.status-queued { background: rgba(201, 107, 49, 0.12); color: var(--accent-dark); }
.status-running { background: rgba(95, 105, 190, 0.12); color: #4450b7; }
.status-success { background: rgba(44, 124, 88, 0.12); color: var(--success); }
.status-published { background: rgba(44, 124, 88, 0.12); color: var(--success); }
.status-partial { background: rgba(77, 107, 173, 0.12); color: #365f9f; }
.status-failed { background: rgba(178, 70, 55, 0.12); color: var(--danger); }

.split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.mono {
    font-family: "Cascadia Code", "JetBrains Mono", monospace;
}

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

.article-preview {
    max-width: 560px;
    color: var(--muted);
}

.article-html {
    line-height: 1.8;
}

.article-html img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
}

.article-cover,
.article-ad-image,
.article-section-image {
    margin: 16px 0;
}

.article-ad-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.article-ad-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 999px;
    color: #fff8f2;
    background: var(--accent);
}

.article-ad-block,
.article-section {
    margin-top: 20px;
}

.schema-builder {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 250, 244, 0.72);
}

.schema-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.schema-list {
    display: grid;
    gap: 10px;
}

.schema-item {
    display: grid;
    grid-template-columns: 32px 180px minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(117, 92, 66, 0.14);
    border-radius: 14px;
    background: #fffdf9;
}

.schema-item.dragging {
    opacity: 0.5;
}

.schema-item-handle {
    cursor: grab;
    user-select: none;
    text-align: center;
    color: var(--muted);
    font-size: 18px;
}

.schema-item-type,
.schema-item-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.schema-source summary {
    cursor: pointer;
    color: var(--muted);
}

.schema-source textarea {
    width: 100%;
    margin-top: 10px;
    min-height: 120px;
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .page-shell {
        height: auto;
    }

    .sidebar {
        gap: 24px;
        position: static;
        left: auto;
        width: auto;
        height: auto;
        overflow: visible;
    }

    .grid-2,
    .grid-3,
    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .schema-item {
        grid-template-columns: 28px 1fr;
    }

    .schema-item-remove,
    .schema-item-type,
    .schema-item-input {
        grid-column: 2;
    }

    .content {
        margin-left: 0;
        width: auto;
        height: auto;
        overflow: visible;
    }
}
