/* ==========================================================================
   问问呢 · 后台样式（黑白灰，无第三方依赖）
   ========================================================================== */

:root {
    --ink: #111111;
    --ink-2: #333333;
    --muted: #6b7280;
    --faint: #9ca3af;
    --line: #e5e7eb;
    --line-2: #f0f1f3;
    --bg: #f7f7f8;
    --card: #ffffff;
    --side: #111111;
    --side-text: #a1a1aa;
    --danger: #b42318;
    --danger-bg: #fff5f4;
    --warn: #92400e;
    --ok: #166534;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, p, dl, dd { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

[hidden] { display: none !important; }

.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.note { margin-top: 12px; padding: 10px 12px; background: #fafafa; border-left: 2px solid var(--ink); font-size: 13px; color: var(--ink-2); }
.link { color: var(--ink-2); font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; }
.link:hover { color: var(--ink); text-decoration: underline; }
.inline-form { display: inline-block; margin: 0; }

/* ---------- 框架 ---------- */
.app { display: flex; min-height: 100%; }

.side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 216px;
    background: var(--side);
    color: var(--side-text);
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.brand {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    color: #fff;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--ink);
    border-radius: 8px;
    font-weight: 700; font-size: 15px;
    flex: none;
}
.brand-text { font-size: 15px; font-weight: 600; letter-spacing: 1px; line-height: 1.2; }
.brand-text small { display: block; font-size: 11px; color: var(--side-text); font-weight: 400; letter-spacing: 1px; }

.nav { flex: 1; overflow-y: auto; padding: 8px 10px 24px; }
.nav-group { margin-top: 14px; }
.nav-title { padding: 6px 10px; font-size: 11px; letter-spacing: 1px; color: #52525b; }
.nav-item {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--side-text);
    border-left: 2px solid transparent;
}
.nav-item:hover { background: #1c1c1f; color: #fff; text-decoration: none; }
.nav-item.is-active { background: #1c1c1f; color: #fff; border-left-color: #fff; }
.nav-sub { padding-left: 18px; }

.side-foot { padding: 12px 18px; font-size: 11px; color: #52525b; border-top: 1px solid #1c1c1f; }

.shell { flex: 1; min-width: 0; margin-left: 216px; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    height: 56px;
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-name { font-size: 13px; color: var(--ink-2); }

.content { padding: 24px; max-width: 1400px; width: 100%; }

.nav-toggle { display: none; }
.icon-btn {
    width: 32px; height: 32px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: var(--ink-2);
}
.nav-mask { display: none; }

/* ---------- 页头 ---------- */
.page { display: flex; flex-direction: column; gap: 18px; }
.page--narrow { max-width: 560px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.meta { margin-top: 4px; font-size: 12px; color: var(--muted); }
.meta .badge { vertical-align: 1px; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 14px; font-weight: 600; }

.stack { display: flex; flex-direction: column; gap: 16px; }

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

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.col-main { min-width: 0; }
.col-side { position: sticky; top: 72px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.25; margin: 6px 0 2px; }
.stat-extra { font-size: 12px; color: var(--faint); }
.stat--accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.stat--accent .stat-label, .stat--accent .stat-extra { color: #a1a1aa; }

/* ---------- 图表 ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; width: 100%; justify-content: center; }
.bar { width: 12px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar--ink { background: var(--ink); }
.bar--soft { background: #d4d4d8; }
.chart-label { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.dot--ink { background: var(--ink); }
.dot--soft { background: #d4d4d8; }

.todo-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--line-2);
    font-size: 13px;
    color: var(--ink-2);
}
.todo-row:last-child { border-bottom: 0; }
.todo-row b { font-size: 15px; color: var(--ink); }
.todo-row:hover { text-decoration: none; color: var(--ink); }

.kv { display: flex; flex-direction: column; gap: 8px; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); font-family: var(--mono); font-size: 12px; text-align: right; word-break: break-all; }
.kv--tight { margin-top: 14px; gap: 6px; }

/* ---------- 表格 ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table thead th {
    font-size: 12px; font-weight: 600; color: var(--muted);
    background: #fcfcfd;
    white-space: nowrap;
    position: sticky; top: 0;
}
.table tbody tr:hover { background: #fcfcfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table--plain { min-width: 0; }
.table--plain thead th { position: static; }
.table .num, .table .w-num { text-align: right; font-family: var(--mono); font-size: 12px; }
.table .ops { text-align: right; white-space: nowrap; }
.table .ops .btn, .table .ops .pop { margin-left: 4px; }
.table .cell-main { font-weight: 500; min-width: 220px; }
.table .cell-sub { margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 400; }
.table .cell-ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .icon-cell { font-size: 16px; }

.w-id { width: 56px; }
.w-num { width: 64px; }
.w-status { width: 84px; }
.w-type { width: 88px; }
.w-cat { width: 80px; }
.w-author { width: 110px; }
.w-time { width: 145px; }
.w-ops { width: 150px; }
.w-icon { width: 56px; }
.w-thumb { width: 88px; }
.w-ip { width: 120px; }

.thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 18px;
    border: 1px solid var(--line);
    background: #fafafa;
    color: var(--ink-2);
    vertical-align: middle;
    white-space: nowrap;
}
.badge--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.badge--ok { background: #f2f9f4; border-color: #cfe8d6; color: var(--ok); }
.badge--warn { background: #fdf8ef; border-color: #f0e0c4; color: var(--warn); }
.badge--danger { background: var(--danger-bg); border-color: #f3cfcb; color: var(--danger); }
.badge--muted { background: #f6f6f7; border-color: var(--line); color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink-2);
    font-size: 13px;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: #fafafa; border-color: #d4d4d8; color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; border-color: #000; color: #fff; }
.btn-danger { background: #fff; border-color: #e3b8b3; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form--wide { max-width: 760px; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--faint); }
.field-key { font-size: 11px; color: var(--faint); }

.field--row { flex-direction: row; align-items: flex-start; gap: 16px; }
.field-side { width: 180px; flex: none; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.field-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.input, .select, .textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
}
.textarea { resize: vertical; min-height: 84px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, .06); }
.input--sm { max-width: 160px; }
.input--date { max-width: 150px; }
.select--sm { height: 30px; padding: 0 8px; font-size: 12px; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--ink); }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filters .input, .filters .select { width: auto; min-width: 160px; }
.filters--add { margin-top: 4px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

.notice {
    padding: 10px 14px;
    background: #fbfbfc;
    border: 1px solid var(--line);
    border-left: 2px solid var(--ink);
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: var(--ink-2);
}

/* ---------- 提示条 ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid var(--line);
    background: #fff;
}
.flash--success { border-color: #cfe8d6; background: #f6fbf7; color: var(--ok); }
.flash--error { border-color: #f3cfcb; background: var(--danger-bg); color: var(--danger); }
.flash-close { border: 0; background: none; font-size: 16px; line-height: 1; color: inherit; cursor: pointer; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 2px 2px 0; }
.pager-info { font-size: 12px; color: var(--muted); }
.pager-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn, .pager-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 9px;
    border: 1px solid var(--line); border-radius: 7px;
    background: #fff; font-size: 12px; color: var(--ink-2);
}
.pager-btn:hover, .pager-num:hover { border-color: #d4d4d8; text-decoration: none; color: var(--ink); }
.pager-num.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager-gap { padding: 0 4px; color: var(--faint); font-size: 12px; }

/* ---------- 空状态 ---------- */
.empty { padding: 36px 12px; text-align: center; color: var(--faint); font-size: 13px; }

/* ---------- 详情页 ---------- */
.prose { font-size: 14px; color: var(--ink-2); line-height: 1.8; }
.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 5px; }
.bar-row-head b { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bar-track { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ink); border-radius: 999px; }

.reason-list li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.reason-list li:last-child { border-bottom: 0; }
.reason-list p { font-size: 13px; color: var(--ink-2); }
.reason-list small { font-size: 11px; color: var(--faint); font-family: var(--mono); }

/* ---------- 弹出层（details） ---------- */
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; cursor: pointer; user-select: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
    width: 260px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
    display: flex; flex-direction: column; gap: 10px;
    text-align: left;
}
.pop[open] > summary { border-color: var(--ink); color: var(--ink); }

/* ---------- 上传 ---------- */
.upload-row { display: flex; gap: 8px; }
.upload-row .input { flex: 1; }
.upload-input { display: none; }
.thumb-preview { margin-top: 8px; max-width: 240px; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); display: block; }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.tab {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--muted);
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---------- 权限勾选 ---------- */
.perm-group { margin: 10px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcfd; }
.perm-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.perm-items { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.field > .check { margin-top: 2px; }

/* ---------- 登录 / 错误页 ---------- */
body.auth { background: #0d0d0f; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 380px; }
.auth-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark--lg { width: 42px; height: 42px; font-size: 20px; border-radius: 12px; background: var(--ink); color: #fff; }
.auth-title { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.auth-sub { font-size: 12px; color: var(--faint); }
.auth-card .form { margin-top: 6px; }
.auth-card .flash { margin-bottom: 14px; }
.auth-tip { margin-top: 16px; text-align: center; font-size: 12px; color: var(--faint); }

.auth-card--error { text-align: center; }
.error-code { font-size: 44px; font-weight: 700; letter-spacing: 2px; line-height: 1; }
.error-title { font-size: 17px; margin: 10px 0 6px; }
.error-message { font-size: 13px; color: var(--muted); line-height: 1.8; }
.error-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
    .grid--main, .cols { grid-template-columns: minmax(0, 1fr); }
    .col-side { position: static; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .side { transform: translateX(-100%); transition: transform .2s ease; }
    .shell { margin-left: 0; }
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    body.nav-open .side { transform: translateX(0); }
    body.nav-open .nav-mask {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, .45);
        border: 0; padding: 0;
        z-index: 25;
    }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .field--row { flex-direction: column; gap: 6px; }
    .field-side { width: auto; padding-top: 0; }
}

/* 默认功能 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.thumb-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumb { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #f3f4f6; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del { position: absolute; top: 0; right: 0; width: 18px; height: 18px; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; line-height: 18px; cursor: pointer; }
.nick-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-height: 320px; overflow: auto; }
.nick-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: #f3f4f6; border-radius: 999px; font-size: 12px; }
.chip-del { border: 0; background: transparent; color: #9ca3af; cursor: pointer; font-size: 12px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }