/* ============================================================
   后台样式 · 与前台同一套亮色蓝色体系
   ============================================================ */

@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../../media/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --canvas: #f4f7fc;
    --surface: #ffffff;
    --surface-2: #eef2f9;
    --surface-3: #e4eaf4;

    --ink: #121a2b;
    --ink-2: #4a5568;
    --ink-3: #8a93a5;

    --line: rgba(18, 26, 43, .09);
    --line-strong: rgba(18, 26, 43, .16);

    --accent: #2f6bff;
    --accent-strong: #1f4fd8;
    --accent-soft: #eaf0ff;
    --accent-on: #ffffff;

    --ok: #0f8a53;
    --err: #d64545;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 6px 18px -6px rgba(16, 24, 40, .12), 0 2px 6px -3px rgba(16, 24, 40, .06);

    --r-lg: 20px;
    --r-md: 14px;

    --ease-out: cubic-bezier(.22, .8, .28, 1);

    --font-display: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    --font-sans: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(760px 420px at 4% -8%, rgba(47, 107, 255, .13), transparent 62%),
        radial-gradient(660px 400px at 98% 2%, rgba(255, 168, 76, .11), transparent 60%),
        var(--canvas);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

.wrap {
    width: min(1060px, 100% - 3rem);
    margin-inline: auto;
}

/* ---------------- 顶栏 ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(16px) saturate(160%);
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    flex-wrap: wrap;
}

.topbar__brand {
    display: inline-flex;
    align-items: baseline;
    gap: .55rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: -.02em;
}

.topbar__brand span {
    color: var(--ink-3);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: .74rem;
    letter-spacing: .04em;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: .15rem;
    flex-wrap: wrap;
}

.topbar__nav a,
.topbar__nav button {
    padding: .38rem .8rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    color: var(--ink-2);
    font: inherit;
    font-size: .84rem;
    cursor: pointer;
    transition: color .25s ease, background .25s ease, border-color .25s ease;
}

.topbar__nav a:hover,
.topbar__nav button:hover { color: var(--ink); background: var(--surface-2); }

.topbar__nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.topbar__nav .nav-exit { color: var(--ink-3); }
.topbar__nav .nav-exit:hover { color: var(--err); background: #fdecec; }

/* ---------------- 主区 ---------------- */
.main { padding: 2rem 0 4rem; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.page-head p {
    margin: .3rem 0 0;
    color: var(--ink-3);
    font-size: .84rem;
}

/* ---------------- 提示条 ---------------- */
.flash {
    margin-bottom: 1.2rem;
    padding: .75rem 1rem;
    border: 1px solid var(--line);
    border-left: 3px solid var(--ok);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--ink-2);
    font-size: .86rem;
    animation: flash-in .45s var(--ease-out) both;
}

.flash--err { border-left-color: var(--err); color: var(--ink); }

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: none; }
}

/* ---------------- 面板 ---------------- */
.panel {
    margin-bottom: 1.4rem;
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.panel__title {
    margin: 0 0 .5rem;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.panel__desc {
    margin: -.1rem 0 1.3rem;
    color: var(--ink-3);
    font-size: .82rem;
}

.panel > form > .field:last-child,
.panel .form-actions:last-child { margin-bottom: 0; }

/* ---------------- 元信息条 ---------------- */
.meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1.4rem;
    margin-bottom: 1.2rem;
    padding: .7rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: .8rem;
}

.meta-bar b { color: var(--ink); }

/* ---------------- 表格 ---------------- */
.table-scroll { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}

th, td {
    padding: .78rem .7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--ink-3);
    font-weight: 500;
    font-size: .76rem;
    letter-spacing: .04em;
    white-space: nowrap;
}

tbody tr { transition: background .25s ease; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

.cell-person {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 200px;
}

.mini-avatar {
    width: 40px;
    height: 40px;
    flex: none;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.mini-avatar--text {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1rem;
}

.mini-cover {
    width: 64px;
    height: 40px;
    flex: none;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.mini-cover--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, var(--accent-soft), var(--surface-2));
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 800;
}

.cell-person b { display: block; font-weight: 600; }

.cell-person small {
    display: block;
    color: var(--ink-3);
    font-size: .78rem;
}

.row-actions {
    display: flex;
    gap: .3rem;
    justify-content: flex-end;
    white-space: nowrap;
}

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

.empty-row {
    padding: 3rem 1rem;
    color: var(--ink-3);
    font-size: .86rem;
    text-align: center;
}

/* 推荐开关 */
.tag-btn {
    padding: .22rem .6rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-3);
    font: inherit;
    font-size: .74rem;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, border-color .25s ease;
}

.tag-btn:hover { border-color: var(--line-strong); color: var(--ink-2); }

.tag-btn.is-on {
    border-color: transparent;
    background: var(--accent);
    color: var(--accent-on);
    font-weight: 600;
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .48rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out),
                border-color .25s ease, background .25s ease, color .25s ease;
}

.btn:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--shadow-md);
}

.btn--primary {
    border-color: transparent;
    background: var(--accent);
    color: var(--accent-on);
    box-shadow: 0 8px 18px -10px var(--accent);
}

.btn--primary:hover {
    background: var(--accent-strong);
    color: var(--accent-on);
    box-shadow: 0 14px 26px -12px var(--accent);
}

.btn--danger { color: var(--err); border-color: var(--line); }
.btn--danger:hover { border-color: var(--err); color: var(--err); background: #fdecec; }

.btn--ghost { border-color: var(--line); color: var(--ink-2); background: transparent; }
.btn--ghost:hover { color: var(--accent); border-color: var(--accent); background: transparent; }

.btn--sm { padding: .3rem .7rem; font-size: .74rem; }

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

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 1.15rem; }

.field > label {
    display: block;
    margin-bottom: .4rem;
    color: var(--ink-2);
    font-size: .82rem;
    font-weight: 500;
}

.field .hint {
    margin: .4rem 0 0;
    color: var(--ink-3);
    font-size: .76rem;
}

.field .hint b { color: var(--ink-2); font-weight: 600; }

/* 时间段：开始月 – 结束月 + 至今 */
.period-row {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.period-row input[type="month"] {
    flex: 1 1 9rem;
    min-width: 0;
    width: auto;
}

.period-row__sep { color: var(--ink-3); }

.period-row .check { white-space: nowrap; }

/* 排序值：用下拉框挑位置；选「自定义」才露出数字框（数字框一直提交） */
.sort-num { margin-top: .55rem; }
.sort-num:not(.is-show) { display: none; }

.req { color: var(--err); }

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="month"],
select,
textarea {
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: .88rem;
    transition: border-color .25s ease, box-shadow .25s ease;
}

select { appearance: none; background-image: none; cursor: pointer; }

textarea { resize: vertical; min-height: 8.5rem; line-height: 1.75; }

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type="file"] {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: .82rem;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: .4rem;
    vertical-align: -2px;
    accent-color: var(--accent);
}

.check {
    display: flex;
    align-items: center;
    gap: .1rem;
    margin-bottom: 0;
    color: var(--ink-2);
    font-size: .84rem;
    font-weight: 500;
    cursor: pointer;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.2rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 1.2rem;
}

/* 「相关链接」一行一条：显示文字 + 链接 + 删除 */
.link-rows { display: grid; gap: .5rem; margin-bottom: .6rem; }

.link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
    align-items: center;
    gap: .5rem;
}

.link-row:empty { display: none; }

@media (max-width: 640px) {
    .link-row { grid-template-columns: 1fr; }
}

/* 更新日志表格里「每行改一次」的小表单 */
.repo-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

.repo-form .repo-form__name { width: 8.5rem; }
.repo-form .repo-form__branch { width: 8rem; }
.repo-form select { width: auto; min-width: 7.5rem; }

.form-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-top: 1.6rem;
    flex-wrap: wrap;
}

.panel > form > .form-actions {
    padding-top: 1.3rem;
    border-top: 1px solid var(--line);
}

/* 社交链接输入行 */
.link-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: .6rem;
    margin-bottom: .55rem;
}

/* 图片预览 */
.avatar-preview,
.cover-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-preview .mini-avatar { width: 64px; height: 64px; border-radius: 16px; font-size: 1.4rem; }

.cover-preview img {
    width: 168px;
    height: 96px;
    flex: none;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
}

.cover-preview__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 168px;
    height: 96px;
    flex: none;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    color: var(--ink-3);
    font-size: .8rem;
}

/* ---------------- 登录页 ---------------- */
.login-body {
    background: #eef2fa;
    overflow-x: hidden;
}

/* 背景上几团慢慢游动的柔光，纯装饰，不挡操作 */
.login-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-aurora i {
    position: absolute;
    display: block;
    width: 46vmax;
    height: 46vmax;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .5;
    animation: aurora 22s ease-in-out infinite alternate;
}

.login-aurora i:nth-child(1) {
    top: -16vmax; left: -12vmax;
    background: radial-gradient(circle at 32% 32%, #7aa2ff, transparent 62%);
}

.login-aurora i:nth-child(2) {
    right: -10vmax; bottom: -20vmax;
    background: radial-gradient(circle at 62% 42%, #ffc48a, transparent 62%);
    animation-delay: -7s;
}

.login-aurora i:nth-child(3) {
    top: 32%; left: 46%;
    width: 32vmax; height: 32vmax;
    background: radial-gradient(circle at 50% 50%, #9be3d8, transparent 62%);
    animation-delay: -13s;
}

@keyframes aurora {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(4vmax, -3vmax, 0) scale(1.15); }
}

.login-page {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.login-card {
    position: relative;
    width: min(400px, 100%);
    padding: 2.2rem 2.1rem 1.9rem;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 255, 255, .88));
    backdrop-filter: blur(18px) saturate(160%);
    box-shadow: 0 30px 70px -34px rgba(16, 24, 40, .4), inset 0 1px 0 rgba(255, 255, 255, .9);
    animation: card-in .6s var(--ease-out) both;
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 2.1rem;
    left: 2.1rem;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--accent), #6f8cff 48%, #ffb877);
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(16px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.login-card__head {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.15rem;
}

.login-card__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: none;
    border-radius: 15px;
    background: linear-gradient(140deg, var(--accent), #5b7dff);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 800;
    box-shadow: 0 14px 26px -14px var(--accent);
}

.login-card__site {
    margin: 0;
    color: var(--ink-3);
    font-size: .72rem;
    letter-spacing: .12em;
}

.login-card h1 {
    margin: .1rem 0 0;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -.03em;
}

.login-card__desc {
    margin: 0 0 1.4rem;
    color: var(--ink-3);
    font-size: .84rem;
}

.login-card .flash { margin-bottom: 1.1rem; }
.login-card .flash--err { animation: shake .4s var(--ease-out) both; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    75%      { transform: translateX(5px); }
}

/* 密码框 + 显示 / 隐藏 */
.pass { position: relative; }

.pass input { padding-right: 4.2rem; }

.pass__toggle {
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    padding: .25rem .6rem;
    border: 0;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-2);
    font: inherit;
    font-size: .74rem;
    cursor: pointer;
    transition: background .25s ease, color .25s ease;
}

.pass__toggle:hover { background: var(--accent-soft); color: var(--accent); }

.login-card .btn--block { margin-top: .3rem; }

.login-card__back {
    margin: 1.3rem 0 0;
    text-align: center;
    font-size: .82rem;
}

/* ---------------- 无障碍 ---------------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

@media (max-width: 700px) {
    .wrap { width: min(1060px, 100% - 2rem); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .link-row { grid-template-columns: 1fr; }
    .cover-preview { flex-direction: column; align-items: flex-start; }
}

/* ---------------- Markdown 预览：与前台同一渲染器 ---------------- */
.forum-md { overflow-wrap: anywhere; }
.forum-md p { margin: 0; }
.forum-md p + p { margin-top: .55rem; }
.forum-md h2, .forum-md h3, .forum-md h4, .forum-md h5, .forum-md h6 {
    margin: 1rem 0 .4rem; color: var(--ink); font-family: var(--font-display); line-height: 1.35;
}
.forum-md h2 { font-size: 1.12rem; }
.forum-md h3 { font-size: 1rem; }
.forum-md h4 { font-size: .94rem; }
.forum-md h5, .forum-md h6 { font-size: .88rem; }
.forum-md ul, .forum-md ol { margin: .45rem 0; padding-left: 1.3rem; }
.forum-md li + li { margin-top: .25rem; }
.forum-md li > p { margin: 0; }
.forum-md .md-task { display: flex; align-items: flex-start; gap: .45rem; list-style: none; margin-left: -1.1rem; }
.forum-md .md-task__box { flex: none; width: .8rem; height: .8rem; margin-top: .33rem; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); }
.forum-md .md-task__box--done { position: relative; border-color: var(--accent); background: var(--accent-soft); }
.forum-md .md-task__box--done::after { content: ""; position: absolute; left: 28%; top: 8%; width: 38%; height: 62%; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(38deg); }
.forum-md .md-quote { margin: .55rem 0; padding: .4rem .5rem .4rem .85rem; border-left: 3px solid var(--line-strong); background: var(--surface-2); }
.forum-md .md-hr { margin: 1rem 0; border: 0; border-top: 1px solid var(--line); }
.forum-md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.forum-md .md-inline-code { padding: .1em .36em; border-radius: 4px; background: var(--surface-3); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
.forum-md .md-code { margin: .7rem 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.forum-md .md-code__bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .3rem .65rem; border-bottom: 1px solid var(--line); background: var(--surface-3); }
.forum-md .md-code__lang { color: var(--ink-3); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; }
.forum-md .md-code__copy { padding: .16rem .5rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-3); font-size: .68rem; cursor: pointer; }
.forum-md .md-pre { margin: 0; padding: .75rem .9rem; overflow-x: auto; max-width: 100%; }
.forum-md .md-pre code { display: block; min-width: max-content; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; line-height: 1.7; white-space: pre; tab-size: 4; }
.forum-md .md-table-wrap { margin: .7rem 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.forum-md .md-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.forum-md .md-table th, .forum-md .md-table td { padding: .45rem .65rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.forum-md .md-table th { background: var(--surface-2); font-weight: 600; }
.forum-md .md-table tbody tr:last-child td { border-bottom: 0; }
.forum-md .md-table .md-align-center { text-align: center; }
.forum-md .md-table .md-align-right { text-align: right; }
.forum-md .md-image { display: block; max-width: 100%; height: auto; margin: .55rem 0; border-radius: var(--r-sm); }

/* ---------------- 语法高亮 token（后台预览也用同一套服务端高亮） ---------------- */
.forum-md .md-pre { overscroll-behavior-x: contain; }
.md-pre .tok-comment, .md-pre .tok-meta { color: #67758a; }
.md-pre .tok-string, .md-pre .tok-ins { color: #0f7a4e; }
.md-pre .tok-keyword, .md-pre .tok-attr, .md-pre .tok-hunk { color: #8a3fb0; }
.md-pre .tok-type, .md-pre .tok-builtin, .md-pre .tok-tag, .md-pre .tok-key { color: #0b6aa0; }
.md-pre .tok-func { color: #9a5b00; }
.md-pre .tok-number { color: #b04a1a; }
.md-pre .tok-var, .md-pre .tok-entity { color: #9a3c74; }
.md-pre .tok-del { color: #b3363a; }

/* ============================================================
   P3 · 统一后台布局与交互
   ============================================================ */

.panel--narrow { max-width: 520px; }

.avatar-preview__field { flex: 1; min-width: 0; }

th.is-right { text-align: right; }

/* 提交中的按钮：保留位置，避免页面跳动 */
.btn.is-busy,
.btn:disabled {
    opacity: .68;
    cursor: progress;
    transform: none;
    box-shadow: none;
}

/* 后台是操作密集型界面：窄屏顶栏收成一行可横向滑动，别占掉半个屏幕 */
@media (max-width: 700px) {
    .topbar__inner {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: .45rem;
    }

    .topbar__brand,
    .topbar__nav {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .topbar__nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: .1rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .topbar__nav::-webkit-scrollbar { display: none; }

    .topbar__nav a,
    .topbar__nav button,
    .topbar__nav form { flex: none; white-space: nowrap; }

    .main { padding-top: 1.4rem; }

    .page-head h1 { font-size: 1.4rem; }

    .panel { padding: 1.15rem; }
}

/* 列表表格在窄屏改成卡片行，避免横向滚动和按钮挤出屏幕 */
@media (max-width: 700px) {
    .table-cards,
    .table-cards tbody { display: block; }

    .table-cards thead { display: none; }

    .table-cards tr {
        display: block;
        padding: .6rem 0;
        border-bottom: 1px solid var(--line);
    }

    .table-cards tbody tr:hover { background: transparent; }
    .table-cards tbody tr:last-child { border-bottom: 0; }

    .table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: .28rem 0;
        border: 0;
    }

    .table-cards td::before {
        content: attr(data-label);
        flex: none;
        color: var(--ink-3);
        font-size: .74rem;
    }

    .table-cards td[data-label=""] {
        display: block;
        padding-bottom: .5rem;
    }

    .table-cards td[data-label=""]::before { display: none; }

    .table-cards .cell-person { min-width: 0; }

    .table-cards .row-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

/* ---------------- 第二批后台页补充 ---------------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .6rem 1rem;
    margin-bottom: 1.1rem;
    padding: .8rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.filters label {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--ink-2);
    font-size: .82rem;
}

.filters select,
.filters input[type="search"] {
    min-width: 8rem;
}

.input-inline {
    width: 9rem;
    padding: .3rem .5rem;
    font-size: .78rem;
}

.row-actions > form {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin: 0;
}

.action-bar {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: .6rem;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    margin-top: 1.2rem;
    color: var(--ink-3);
    font-size: .82rem;
}

.is-muted td,
.is-muted .forum-item__head {
    opacity: .58;
}

.forum-item {
    padding: .85rem 0;
    border-top: 1px solid var(--line);
}

.forum-item:first-of-type { border-top: 0; padding-top: 0; }

.forum-item__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .35rem;
    font-size: .84rem;
}

.forum-item__head .muted { font-size: .76rem; }

.forum-item .rewrite {
    margin-top: .5rem;
}

.forum-item .rewrite textarea { min-height: 4.5rem; }

.api-key {
    display: block;
    width: 100%;
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
    color: var(--accent-strong);
}

.toolbar-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}

@media (max-width: 640px) {
    .filters { align-items: stretch; }
    .filters label { width: 100%; justify-content: space-between; }
    .row-actions { flex-wrap: wrap; justify-content: flex-start; }
    .input-inline { width: 100%; }
}
