/* ==========================================================================
   云上社区管理后台 · 样式
   无外部依赖，深浅两套自适应（默认深色侧栏 + 浅色内容区）
   ========================================================================== */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #1f2328;
    --muted: #6b7280;
    --primary: #2f6fed;
    --primary-dark: #1f57c9;
    --ok: #14835b;
    --warn: #b45309;
    --danger: #c0342b;
    --sidebar: #141821;
    --sidebar-2: #1c2230;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.ellipsis { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------- 布局 ------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 228px;
    flex: 0 0 228px;
    background: var(--sidebar);
    color: #c9d1de;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand strong { display: block; color: #fff; font-size: 14.5px; font-weight: 600; }
.brand small { color: #7d8798; font-size: 11.5px; }
.brand-dot {
    width: 10px; height: 10px; border-radius: 3px;
    background: linear-gradient(135deg, #58c08a, #2f6fed);
    box-shadow: 0 0 0 4px rgba(88,192,138,.12);
    flex: 0 0 auto;
}

.nav { padding: 10px 10px 20px; flex: 1; }
.nav-group {
    padding: 14px 10px 6px;
    font-size: 11px;
    letter-spacing: .08em;
    color: #667085;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #c3cbd8;
    font-size: 13.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.nav-item.active { background: #24304a; color: #fff; }
.nav-icon { width: 18px; text-align: center; opacity: .85; font-size: 13px; }
.nav-label { flex: 1; }
.badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #eef1f6;
    color: var(--muted);
    font-size: 11.5px;
    text-align: center;
}
.nav-item .badge { background: #c0342b; color: #fff; padding: 0 6px; line-height: 17px; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.logout { color: #98a2b3; font-size: 13px; }
.logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 58px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 15.5px; font-weight: 600; margin: 0; flex: 1; }
.menu-btn { display: none; background: none; border: 0; font-size: 18px; cursor: pointer; }

.who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.who-role { color: var(--muted); font-size: 12px; }
.avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: #e8eefc; color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex: 0 0 auto;
}
.avatar-img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.avatar-lg { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-xl { width: 56px; height: 56px; font-size: 22px; }

.content { padding: 22px; max-width: 1500px; width: 100%; }

/* ------------------------------- 卡片 ------------------------------- */
.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.card, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-card { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 2px; }
.stat-sub { color: var(--muted); font-size: 12px; }
.c-blue { color: #2f6fed; }
.c-green { color: #14835b; }
.c-purple { color: #7c3aed; }
.c-orange { color: #c2410c; }

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.panel { margin-bottom: 16px; overflow: hidden; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 14px; margin: 0; font-weight: 600; }
.link { font-size: 12.5px; }

/* ------------------------------- 图表 ------------------------------- */
.chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 180px;
    padding: 16px 18px 10px;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; width: 100%; justify-content: center; }
.bar { width: 12px; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .2s; }
.bar-space { background: #2f6fed; }
.bar-user { background: #58c08a; }
.chart-label { font-size: 11px; color: var(--muted); }

/* ------------------------------- 列表 ------------------------------- */
.mini-list { list-style: none; margin: 0; padding: 6px 0; }
.mini-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid #f1f3f7;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-main { flex: 1; min-width: 0; }
.mini-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { padding: 26px 18px; color: var(--muted); text-align: center; margin: 0; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
    border: 1px solid #d6dae2;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13.5px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}
.search-form input[type=text] { min-width: 220px; }
.filter { min-width: 120px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid #d6dae2;
    background: #fff;
    color: var(--text);
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 13.5px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.btn:hover { background: #f7f8fa; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #f0c9c5; background: #fff7f6; }
.btn-danger:hover { background: #fdeceb; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 10px; font-size: 14.5px; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.bulk-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.bulk-form .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f2f6;
    vertical-align: middle;
}
.table thead th {
    background: #fafbfc;
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
.table tbody tr:hover { background: #fafbfe; }
.table tbody tr:last-child td { border-bottom: 0; }
.col-check { width: 36px; }
.col-actions { text-align: right; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.inline { display: inline; }
.sort-link { color: inherit; }
.sort-link:hover { color: var(--primary); text-decoration: none; }

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

.badge-ok { background: #e7f6ee; color: var(--ok); }
.badge-warn { background: #fdf3e3; color: var(--warn); }
.badge-danger { background: #fdeceb; color: var(--danger); }
.badge-muted { background: #f1f3f7; color: var(--muted); }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 2px 4px;
    flex-wrap: wrap;
    font-size: 13px;
}
.pager-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.pg {
    min-width: 32px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    text-align: center;
    font-size: 12.5px;
}
.pg:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pg.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pg.disabled { color: #b6bcc8; background: #f7f8fa; border-color: #eef0f4; }

/* ------------------------------- 表单 ------------------------------- */
.form-panel .panel-head { background: #fcfcfd; }
.form { padding: 6px 18px 18px; }
.form-row { display: flex; gap: 16px; padding: 11px 0; border-bottom: 1px dashed #eef0f4; }
.form-row:last-of-type { border-bottom: 0; }
.form-label { flex: 0 0 120px; color: var(--muted); font-size: 13px; padding-top: 8px; }
.form-control { flex: 1; min-width: 0; }
.form-control input[type=text], .form-control input[type=number], .form-control input[type=password],
.form-control input[type=datetime-local], .form-control select, .form-control textarea { width: 100%; }
.form-control textarea { resize: vertical; line-height: 1.6; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.hint { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.form-actions { display: flex; align-items: center; gap: 10px; padding-top: 16px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.switch input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ------------------------------- 用户 ------------------------------- */
.user-cell { display: flex; align-items: center; gap: 9px; }
.user-name { font-weight: 550; }
.user-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    flex-wrap: wrap;
}
.user-summary-main { flex: 1; min-width: 220px; }
.user-summary-main h3 { margin: 0 0 4px; font-size: 16px; }
.user-summary-main h3 small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.user-summary-actions { display: flex; gap: 8px; align-items: center; }
.user-summary-actions form { display: flex; gap: 8px; align-items: center; }

/* ------------------------------- 版本 ------------------------------- */
.version-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(120deg, #f4f8ff, #f7fdf9);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.version-name { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.version-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.version-url {
    margin: 0;
    padding: 12px 18px 0;
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}
.tips { margin: 0; padding: 12px 18px 18px 34px; color: #3d4452; font-size: 13px; }
.tips li { margin-bottom: 8px; }

.kv { padding: 6px 18px 14px; }
.kv-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #eef0f4; font-size: 13px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row span { flex: 0 0 90px; color: var(--muted); }
.kv-row strong, .kv-row code { word-break: break-all; }

/* ------------------------------- 提示 ------------------------------- */
.flash {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-ok { background: #eaf7f0; color: #0f6b4a; border-color: #c6e9d7; }
.flash-err { background: #fdeceb; color: #a12a22; border-color: #f5cfcb; }

/* ------------------------------- 登录 ------------------------------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 600px at 20% 10%, #1d2740 0%, #0f131b 55%, #0b0e14 100%);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 14px;
    padding: 26px 26px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-head { text-align: center; margin-bottom: 18px; }
.login-head .brand-dot { display: inline-block; margin-bottom: 10px; }
.login-head h1 { font-size: 19px; margin: 0 0 4px; }
.login-head p { color: var(--muted); font-size: 12.5px; margin: 0; }
.field { display: block; margin-bottom: 13px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; }
.login-foot { text-align: center; color: var(--muted); font-size: 11.5px; margin: 16px 0 0; }

/* ------------------------------- 响应式 ------------------------------- */
@media (max-width: 1180px) {
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform .2s;
        z-index: 50;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-btn { display: block; }
    .content { padding: 14px; }
    .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .form-row { flex-direction: column; gap: 6px; }
    .form-label { padding-top: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .who-name, .who-role { display: none; }
    .search-form input[type=text] { min-width: 0; width: 100%; }
}

/* ------------------------------- 举报处置 ------------------------------- */
.report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 18px 10px;
}
.report-actions form { display: flex; align-items: center; gap: 8px; }
