/* ============================================================================
   DataCMS 后台样式
   单文件、无构建、无外网依赖。改样式只改这里。
   ========================================================================== */

:root {
    --c-bg: #f4f5f7;
    --c-surface: #ffffff;
    --c-surface-2: #fafbfc;
    --c-line: #e4e6eb;
    --c-line-strong: #d3d6dd;
    --c-ink: #14161c;
    --c-ink-2: #3d4453;
    --c-muted: #6b7280;
    --c-dim: #9aa1ad;
    --c-primary: #2f6df6;
    --c-primary-dark: #1f57d6;
    --c-primary-soft: #eef3ff;
    --c-danger: #d92d20;
    --c-danger-soft: #fef3f2;
    --c-ok: #087443;
    --c-ok-soft: #ecfdf3;
    --c-warn: #b54708;
    --c-warn-soft: #fffaeb;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 6px 20px rgba(16, 24, 40, .08);
    --sidebar-w: 232px;
    --top-h: 56px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.admin {
    background: var(--c-bg);
    color: var(--c-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------- 顶栏 ------------------------------- */

.topline {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--top-h);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--c-line);
}

.topline-brand { font-weight: 650; letter-spacing: .2px; }
.topline-brand em { font-style: normal; font-weight: 400; color: var(--c-dim); font-size: 12px; margin-left: 4px; }
.topline-right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topline-link { color: var(--c-muted); }
.topline-user { color: var(--c-ink-2); padding-left: 14px; border-left: 1px solid var(--c-line); }

.menu-toggle { display: none; }

/* ------------------------------- 侧栏 ------------------------------- */

.shell { display: flex; align-items: flex-start; }

.sidebar {
    position: sticky;
    top: var(--top-h);
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    height: calc(100vh - var(--top-h));
    display: flex;
    flex-direction: column;
    background: #10141d;
    color: #c4cad6;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* 侧栏品牌块（logo + 品牌字）已去掉，品牌名只在顶栏展示，与 php-cms 一致 */

.side-nav { padding: 16px 10px 20px; }

.nav-group + .nav-group { margin-top: 6px; }

.nav-label {
    padding: 14px 10px 6px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6b7486;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #c4cad6;
    font-size: 13.5px;
}

.nav-item:hover { background: #1a2030; color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(47, 109, 246, .18); color: #fff; font-weight: 550; }
.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #4d86ff;
}

.nav-icon { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item.is-active .nav-icon { opacity: 1; }

.sidebar-foot {
    margin-top: auto;
    padding: 14px 20px;
    font-size: 11.5px;
    color: #5d6577;
    border-top: 1px solid #1c2230;
}

/* ------------------------------- 主区 ------------------------------- */

.main {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 26px 32px 72px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -.2px; }
.page-desc { margin-top: 4px; color: var(--c-muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------- 卡片 ------------------------------- */

.card {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--c-line);
    background: var(--c-surface-2);
}

.card-head h2 { font-size: 14px; font-weight: 620; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ------------------------------- 表单 ------------------------------- */

.field { margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 560; color: var(--c-ink-2); }
.field .req { color: var(--c-danger); margin-left: 3px; }

.input {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--c-ink);
    font: inherit;
    font-size: 13.5px;
    transition: border-color .15s, box-shadow .15s;
}

.input:hover { border-color: #b9bec8; }
.input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(47, 109, 246, .14);
}

.input::placeholder { color: var(--c-dim); }
.input.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.textarea { resize: vertical; line-height: 1.65; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.hint { margin-top: 5px; font-size: 12px; color: var(--c-muted); line-height: 1.5; }
.hint code { background: #f1f3f6; padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.form-row > .field { flex: 1; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.field-check { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 10px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--c-ink-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--c-primary); }

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0 0;
    flex-wrap: wrap;
}

.form-actions .spacer { margin-left: auto; }

/* ------------------------------- 按钮 ------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 15px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--c-ink-2);
    font: inherit;
    font-size: 13.5px;
    font-weight: 520;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.btn:hover { background: #f7f8fa; border-color: #b9bec8; text-decoration: none; }
.btn:active { background: #eef0f3; }

.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); }

.btn-danger { color: var(--c-danger); border-color: #f3c3bf; background: #fff; }
.btn-danger:hover { background: var(--c-danger-soft); border-color: #e8a9a3; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--c-muted); }
.btn-ghost:hover { background: #f1f3f6; border-color: transparent; color: var(--c-ink); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    background: #fff;
    color: var(--c-ink-2);
    cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }

.inline-form { display: inline; }

/* ------------------------------- 工具栏 / 筛选 ------------------------------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--c-line);
    flex-wrap: wrap;
}

.toolbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters .input { width: auto; min-width: 140px; }
.filters .input[type="search"] { min-width: 220px; }

/* ------------------------------- 表格 ------------------------------- */

.table-wrap { overflow-x: auto; }

table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th, table.table td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--c-line); }
table.table th { background: var(--c-surface-2); font-weight: 560; font-size: 12.5px; color: var(--c-muted); white-space: nowrap; }
table.table tbody tr:hover { background: #fbfcfd; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table td.num { width: 1%; white-space: nowrap; color: var(--c-dim); font-variant-numeric: tabular-nums; }
table.table td.actions { width: 1%; white-space: nowrap; }
/* 标题列吃掉全部剩余宽度（页面已铺满，旧的 460px 上限会让右侧留大片空白） */
/* 标题列吃掉全部剩余宽度（页面已铺满，旧的 460px 上限会让右侧留大片空白）。
   注意别写 width:100%——auto 表格布局下它会把其他可折行的文字列压到一字一行。 */
table.table .title-cell { max-width: none; }
table.table .title-cell a { color: var(--c-ink); font-weight: 520; }
table.table .title-cell a:hover { color: var(--c-primary); }
table.table .sub { margin-top: 3px; font-size: 12px; color: var(--c-muted); }

/* 表格里的长名单（域名 / IP 白名单，ui_line_list() 输出）。
   以前 nl2br 直出，白名单几十条就把一行撑成半屏、整页跟着塌下去；
   现在固定只占 --line-visible 行（默认 3 行），其余滑动或点「展开」看。 */
.line-list { --line-visible: 3; }
.line-list-box {
    max-height: calc(1.55em * var(--line-visible) + 1px);
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.55;
    word-break: break-all;
    scrollbar-width: thin;
}
.line-list-box .line { display: block; }
/* 点开只是把可视区放大，不放开成整页高 —— 「展开」也不该把页面顶长 */
.line-list.is-open .line-list-box { max-height: calc(1.55em * 9 + 1px); }
.line-list-toggle {
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-primary);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}
.line-list-toggle:hover { text-decoration: underline; }

.table-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-top: 1px solid var(--c-line);
    flex-wrap: wrap;
    font-size: 12.5px;
}

.thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--c-line);
    background: #f1f3f6;
    display: block;
}

/* 操作按钮固定一行：不折行、不挤压，列宽由内容撑开（表格外层已有横向滚动兜底） */
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.row-actions > * { flex: 0 0 auto; }
.row-actions .inline-form { display: flex; align-items: center; }
.row-actions .btn { white-space: nowrap; }

/* ------------------------------- 徽标 / 提示 ------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    height: 21px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f1f3f6;
    color: var(--c-muted);
    font-size: 11.5px;
    font-weight: 520;
    white-space: nowrap;
}
.badge-ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge-draft { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-blue { background: var(--c-primary-soft); color: var(--c-primary-dark); }
.badge-top { background: #fff1f0; color: #c4320a; }

.flash {
    margin-bottom: 16px;
    padding: 11px 15px;
    border-radius: 9px;
    border: 1px solid #a7e8c4;
    background: var(--c-ok-soft);
    color: #05603a;
    font-size: 13.5px;
}
.flash-error { border-color: #f3c3bf; background: var(--c-danger-soft); color: #912018; }
.flash-info { border-color: #c7d7fe; background: var(--c-primary-soft); color: #1e40af; }

.notice {
    padding: 12px 15px;
    border-radius: 9px;
    background: var(--c-primary-soft);
    border: 1px solid #d5e0ff;
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.65;
}

.error-list { margin: 0; padding-left: 18px; }

.empty { padding: 52px 20px; text-align: center; color: var(--c-muted); }
.empty p { margin-bottom: 12px; font-size: 13.5px; }

/* ------------------------------- 详情 / 折叠 ------------------------------- */

.details {
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    background: var(--c-surface);
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.details > summary {
    padding: 14px 18px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 560;
    color: var(--c-ink-2);
    list-style: none;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary::before { content: "＋"; display: inline-block; width: 18px; color: var(--c-dim); }
.details[open] > summary::before { content: "－"; }
.details[open] > summary { border-bottom: 1px solid var(--c-line); }
.details-body { padding: 18px; }

.muted { color: var(--c-muted); }
.dim { color: var(--c-dim); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

/* ------------------------------- 仪表盘 ------------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}
.stat .stat-label { font-size: 12.5px; color: var(--c-muted); }
.stat .stat-value { margin-top: 6px; font-size: 26px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .stat-sub { margin-top: 4px; font-size: 12px; color: var(--c-dim); }
.stat.accent .stat-value { color: var(--c-primary); }

.dash-cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.quick-list { display: flex; flex-direction: column; }
.quick-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px dashed var(--c-line);
    font-size: 13.5px;
}
.quick-item:last-child { border-bottom: 0; }
.quick-item a { display: inline-flex; align-items: center; gap: 8px; }

/* ------------------------------- 图片字段 ------------------------------- */

.media-field { display: flex; gap: 14px; align-items: flex-start; }
.media-preview {
    flex: none;
    width: 116px;
    height: 80px;
    border: 1px solid var(--c-line);
    border-radius: 8px;
    background: var(--c-surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.media-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-empty { font-size: 12px; color: var(--c-dim); }
.media-body { flex: 1; min-width: 0; }
.media-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* 媒体选择弹窗 */
.media-picker[hidden] { display: none; }
.media-picker { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.mp-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.mp-panel {
    position: relative;
    width: min(880px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 60px));
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}
.mp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--c-line); }
.mp-head h2 { font-size: 15px; font-weight: 620; }
.mp-actions { display: flex; gap: 8px; }
.mp-body { padding: 16px; overflow-y: auto; }
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.mp-item { border: 1px solid var(--c-line); border-radius: 9px; overflow: hidden; cursor: pointer; background: #fff; padding: 0; text-align: left; }
.mp-item:hover { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(47, 109, 246, .12); }
.mp-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #f1f3f6; }
.mp-item span { display: block; padding: 6px 8px; font-size: 11.5px; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-loading { padding: 40px; text-align: center; color: var(--c-muted); }

/* ------------------------------- 编辑器 ------------------------------- */

/* 内容编辑：主栏 + 右侧发布面板 */
.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
.editor-side { position: sticky; top: calc(var(--top-h) + 20px); }
.editor-main .field { margin-bottom: 18px; }

.editor-shell { border: 1px solid var(--c-line-strong); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.editor-toolbar { border-bottom: 1px solid var(--c-line); }
.editor-container { height: 460px; overflow-y: auto; }
.body-fallback {
    min-height: 380px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

/* ------------------------------- 媒体库 ------------------------------- */

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px;
    padding: 18px;
}

.media-card {
    position: relative;
    display: block;
    border: 1px solid var(--c-line);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

.media-card:hover { border-color: #b9c4dc; box-shadow: var(--shadow-sm); }
.media-card:has(input:checked) { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(47, 109, 246, .14); }

.media-card input[type="checkbox"] {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 16px;
    height: 16px;
    accent-color: var(--c-primary);
    z-index: 2;
    background: #fff;
    border-radius: 4px;
}

.mc-img { display: block; background: #f1f3f6; }
.mc-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.mc-info { display: block; padding: 8px 10px 10px; }
.mc-name { display: block; font-size: 12px; color: var(--c-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-meta { display: block; margin: 2px 0 6px; font-size: 11.5px; color: var(--c-dim); }

/* ------------------------------- 分页 ------------------------------- */

.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid var(--c-line);
    border-radius: 6px;
    background: #fff;
    color: var(--c-ink-2);
    font-size: 12.5px;
}
.pager-btn:hover { background: #f7f8fa; text-decoration: none; }
.pager-btn.current { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pager-btn.disabled { color: var(--c-dim); background: var(--c-surface-2); cursor: not-allowed; }
.pager-gap { padding: 0 4px; color: var(--c-dim); }

/* ------------------------------- 登录页 ------------------------------- */

body.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 520px at 15% 0%, #e6edff 0%, transparent 60%),
        radial-gradient(700px 480px at 90% 100%, #e8f6f0 0%, transparent 55%),
        #f4f5f7;
}

.login-box { width: min(400px, calc(100vw - 32px)); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-brand .logo {
    width: 38px; height: 38px; border-radius: 10px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #3d7bff, #2f6df6);
    color: #fff; font-weight: 700; font-size: 18px;
}
.login-brand strong { font-size: 17px; }
.login-card {
    background: #fff;
    border: 1px solid var(--c-line);
    border-radius: 14px;
    padding: 26px 24px;
    box-shadow: 0 10px 40px rgba(16, 24, 40, .07);
}
.login-card h1 { font-size: 18px; margin-bottom: 4px; }
.login-card .sub { color: var(--c-muted); font-size: 13px; margin-bottom: 20px; }
.login-foot { margin-top: 16px; text-align: center; font-size: 12px; color: var(--c-dim); }

/* ------------------------------- 404 ------------------------------- */

body.error-page { min-height: 100vh; display: grid; place-items: center; background: var(--c-bg); }
.error-box { text-align: center; padding: 40px; }
.error-box .code { font-size: 64px; font-weight: 700; color: var(--c-line-strong); letter-spacing: -3px; }
.error-box h1 { font-size: 18px; margin: 10px 0 6px; }
.error-box p { color: var(--c-muted); font-size: 13.5px; margin-bottom: 18px; }

/* ------------------------------- 响应式 ------------------------------- */

@media (max-width: 1080px) {
    .dash-cols { grid-template-columns: 1fr; }
    .editor-layout { grid-template-columns: 1fr; }
    .editor-side { position: static; }
}

@media (max-width: 860px) {
    .menu-toggle { display: inline-grid; }
    .topline-brand { display: none; }

    .sidebar {
        position: fixed;
        top: var(--top-h);
        left: 0;
        bottom: 0;
        height: auto;
        z-index: 45;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-md);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open::after {
        content: "";
        position: fixed;
        inset: var(--top-h) 0 0 0;
        background: rgba(15, 23, 42, .38);
        z-index: 44;
    }

    .main { padding: 18px 16px 56px; }
    .page-head { flex-direction: column; gap: 12px; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .media-field { flex-direction: column; }
    .media-preview { width: 100%; height: 150px; }
    table.table th, table.table td { padding: 10px 10px; }
    table.table .title-cell { max-width: 220px; }
}

@media (max-width: 640px) {
    .filters .input[type="search"] { min-width: 100%; }
    .filters .input { flex: 1; }
    .toolbar { align-items: stretch; }
    .toolbar-right { margin-left: 0; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
 * 一期兼容样式（老视图类名：pager_html / wangeditor / code-block）
 * ======================================================================== */
.pager {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    margin-top: 20px;
}
.pager a, .pager .cur {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 30px; padding: 0 10px;
    border: 1px solid var(--c-line); border-radius: 8px;
    background: var(--c-surface); font-size: 13px; color: var(--c-ink-2);
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.pager a:hover {
    background: #f3f5f9; border-color: var(--c-line-strong);
    color: var(--c-ink); text-decoration: none;
}
.pager .cur {
    background: var(--c-primary); border-color: var(--c-primary);
    color: #fff; font-weight: 600;
}
.pager .pager-nav { min-width: auto; padding: 0 14px; }
.pager .pager-nav.disabled {
    color: var(--c-dim); background: var(--c-surface-2);
    border-color: var(--c-line); cursor: not-allowed;
}
.pager .pager-gap {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 30px; padding: 0 2px;
    color: var(--c-dim); font-size: 13px;
}
.pager .pager-info {
    margin-left: 6px; color: var(--c-dim); font-size: 12.5px;
}

.code-block {
    background: #f6f8fa; border: 1px solid var(--c-line); border-radius: var(--radius-sm);
    padding: 14px 16px; overflow: auto; font-size: 12.5px; line-height: 1.65;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap; word-break: break-all; margin: 10px 0;
}
.key-cell {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; word-break: break-all;
}
.cover-preview {
    display: block; max-width: 220px; max-height: 140px; object-fit: cover;
    border: 1px solid var(--c-line); border-radius: var(--radius-sm); margin-bottom: 8px;
}
