﻿/* ============================================================
   后台管理样式（前台 site.css 不参与后台页面）
   ============================================================ */

:root {
    --brand: #1656E0;
    --brand-50: #EEF4FF;
    --ink: #101a2e;
    --muted: #7d8798;
    --line: #e7ecf5;
    --bg: #f5f7fb;
    --danger: #e5484d;
    --ok: #12b76a;
}

* { box-sizing: border-box; }
body {
    margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px; line-height: 1.7; color: var(--ink); background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-size: 16px; }
img { max-width: 100%; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(140deg, #123e9e, #1656E0 55%, #4b8bff); }
.login-box { width: 100%; max-width: 400px; padding: 34px 34px 28px; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(8, 24, 70, .28); }
.login-logo { display: block; width: 132px; margin: 0 auto 12px; }
.login-box h1 { font-size: 20px; text-align: center; }
.login-box .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 22px; }
.login-box label { display: block; margin-bottom: 5px; font-weight: 600; }
.login-box input { width: 100%; height: 42px; margin-bottom: 16px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
.login-box input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 86, 224, .12); }
.login-tip { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.aside { width: 208px; flex: none; background: #101a2e; color: #b6c0d4; padding: 18px 0; }
.aside .logo { padding: 0 20px 18px; font-size: 17px; font-weight: 700; color: #fff; }
.aside .logo img { display: block; height: 32px; width: auto; margin-bottom: 10px; }
.aside .logo small { display: block; font-size: 11px; font-weight: 400; color: #6b7896; letter-spacing: 1px; }
.aside a.nav-item { display: block; padding: 10px 20px; color: #b6c0d4; font-size: 14px; border-left: 3px solid transparent; }
.aside a.nav-item:hover { color: #fff; background: #18233c; text-decoration: none; }
.aside a.nav-item.is-on { color: #fff; background: #1c2a46; border-left-color: var(--brand); }
.aside .grp { margin: 14px 20px 6px; font-size: 11px; letter-spacing: 1px; color: #5a6784; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 22px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h2 { font-size: 16px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.content { padding: 20px 22px 40px; }

/* ---------- 组件 ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.panel-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-title h3 { font-size: 15px; }
.panel-title .right { margin-left: auto; display: flex; gap: 8px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; height: 34px; padding: 0 14px;
    border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
    font-size: 13px; font-family: inherit; cursor: pointer; transition: .18s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #1b5ff3; color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-lg { height: 42px; font-size: 14px; width: 100%; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 13px; }
table.grid th { background: #f8fafd; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.grid tr:hover td { background: #fafcff; }
table.grid td.thumb img { width: 92px; height: 58px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
table.grid .ops { display: flex; gap: 6px; flex-wrap: wrap; }
table.grid .name { font-weight: 600; color: var(--ink); }
table.grid .sub { color: var(--muted); font-size: 12px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f6; color: var(--muted); }
.pill-on { background: rgba(18, 183, 106, .12); color: #0a8a50; }
.pill-off { background: #f1f3f7; color: #8b93a3; }
.pill-top { background: rgba(255, 138, 61, .14); color: #c2571b; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.field label small { font-weight: 400; color: var(--muted); }
.field input[type=text], .field input[type=password], .field input[type=number], .field textarea, .field select {
    width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px;
    font-size: 13px; font-family: inherit; color: var(--ink); background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22, 86, 224, .1); }
.field textarea { min-height: 90px; resize: vertical; }
.field .row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field .row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field .inline { display: flex; align-items: center; gap: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.editor-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.editor-tools .btn { height: 28px; }
textarea.code { min-height: 320px; font-family: Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.6; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-ok { background: rgba(18, 183, 106, .1); color: #0a8a50; }
.alert-err { background: rgba(229, 72, 77, .1); color: #c0393e; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat-box b { display: block; font-size: 26px; color: var(--brand); }
.stat-box span { font-size: 12px; color: var(--muted); }

.pager { display: flex; gap: 6px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.pager a, .pager span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.pager .is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 弹窗（二次确认） ---------- */
.mask { position: fixed; inset: 0; background: rgba(16, 26, 46, .45); display: none; align-items: center; justify-content: center; z-index: 100; }
.mask.is-open { display: flex; }
.dialog { width: calc(100vw - 32px); max-width: 380px; background: #fff; border-radius: 12px; padding: 22px 24px; box-shadow: 0 20px 50px rgba(8, 24, 70, .25); }
.dialog h4 { font-size: 15px; margin-bottom: 6px; }
.dialog p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.dialog input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px; font-size: 16px; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #101a2e; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 120; opacity: 0; transition: .25s; }
.toast.is-on { opacity: 1; }

@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .aside { width: auto; display: flex; flex-wrap: wrap; padding: 10px; }
    .aside .logo { width: 100%; padding-bottom: 8px; }
    .aside .grp { display: none; }
    .aside a.nav-item { border-left: 0; border-radius: 6px; padding: 8px 12px; }
    .topbar { height: auto; min-height: 56px; padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
    /* 标题 + 右侧按钮在窄屏换行，否则留言页那三个筛选按钮会把面板撑出去 */
    .panel-title { flex-wrap: wrap; }
    .panel-title .right { margin-left: 0; flex-wrap: wrap; }
    .content { padding: 14px 14px 32px; }
    .panel { padding: 14px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .field .row, .field .row3 { grid-template-columns: 1fr; }
    /* 手机上表格列宽压不进：让表格自己横向滚，别把整页撑出横向滚动条 */
    table.grid { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.grid th, table.grid td { padding: 8px; }
    table.grid td.hide-s { display: none; }
    /* iOS 聚焦 <16px 输入框会放大页面且回不去 */
    .field input[type=text], .field input[type=password], .field input[type=number], .field textarea, .field select { font-size: 16px; }
    .btn, .pager a, .pager span { min-height: 40px; }
}
