/* ============================================================
   舆情控制中控台 — 全站统一样式（关键诉求：字体/字号/表格风格统一）
   所有页面共用此文件的 CSS 变量与组件类。
   ============================================================ */

:root {
    /* 字体与字号：全站统一 */
    --font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --fs-page-title: 20px;   /* 页面大标题 */
    --fs-card-title: 18px;   /* 卡片标题 */
    --fs-body: 14px;         /* 正文 / 表格 */
    --fs-small: 13px;        /* 辅助说明 */
    --fw-title: 700;

    /* 配色（日间） */
    --c-bg: #f0f2f5;
    --c-card: #ffffff;
    --c-text: #1f2329;
    --c-text-2nd: #646a73;
    --c-border: #e5e6eb;
    --c-primary: #1f2329;    /* 主按钮黑 */
    --c-primary-text: #ffffff;
    --c-accent: #2f54eb;     /* 分页/链接蓝 */
    --c-sidebar-bg: #14142b;
    --c-sidebar-text: #b9bcd0;
    --c-sidebar-active: #ffffff;
    --c-sidebar-active-bg: rgba(255, 255, 255, 0.12);
    --c-topbar-bg: #14142b;
    --c-table-head: #000000;
    --c-table-head-text: #ffffff;
    --c-table-stripe: #f7f8fa;
    --c-danger: #d4380d;
    --c-role-ops: #2f54eb;   /* 技术运维 蓝 */
    --c-role-admin: #389e0d; /* 管理员 绿 */
    --c-role-recorder: #8c8c8c; /* 收录员 灰 */

    /* 尺寸 */
    --radius-card: 10px;
    --radius-btn: 6px;
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.08);
    --sidebar-w: 210px;
    --topbar-h: 44px;
}

/* 夜览模式 */
html.night {
    --c-bg: #16161f;
    --c-card: #1f1f2b;
    --c-text: #e8e8ec;
    --c-text-2nd: #9a9aad;
    --c-border: #33333f;
    --c-primary: #e8e8ec;
    --c-primary-text: #16161f;
    --c-table-stripe: #262633;
    --c-table-head: #000000;
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font-family);
    font-size: var(--fs-body);
    color: var(--c-text);
    background: var(--c-bg);
}

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

/* ---------- 布局骨架 ---------- */

.layout { display: flex; min-height: 100vh; }

.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
    background: var(--c-topbar-bg); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-body); letter-spacing: 1px; z-index: 100;
}

.sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
    width: var(--sidebar-w); background: var(--c-sidebar-bg);
    display: flex; flex-direction: column; z-index: 99;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 8px;
    padding: 18px 16px 12px; color: #fff;
    font-size: 15px; font-weight: var(--fw-title);
    white-space: nowrap;
}
.sidebar .brand .logo { width: 46px; height: 46px; object-fit: contain; }
.sidebar .menu-label {
    padding: 8px 16px; color: var(--c-sidebar-text);
    font-size: var(--fs-small);
}
.sidebar nav { flex: 1; overflow-y: auto; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 16px; margin: 2px 10px; border-radius: 8px;
    color: var(--c-sidebar-text); font-size: var(--fs-body);
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.sidebar nav a.active {
    background: var(--c-sidebar-active-bg); color: var(--c-sidebar-active);
    font-weight: var(--fw-title);
}
.sidebar nav a .icon { width: 18px; text-align: center; }

.sidebar .sidebar-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; color: var(--c-sidebar-text); font-size: var(--fs-small);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.main {
    flex: 1; margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
    padding: 20px 24px; min-width: 0;
}

/* ---------- 卡片 ---------- */

.card {
    background: var(--c-card); border-radius: var(--radius-card);
    box-shadow: var(--shadow-card); padding: 20px 24px;
    margin-bottom: 18px;
}
.card-title {
    font-size: var(--fs-card-title); font-weight: var(--fw-title);
    margin-bottom: 14px;
}
.card .hint-list { list-style: none; }
.card .hint-list li {
    display: flex; align-items: baseline; gap: 10px;
    color: var(--c-text-2nd); font-size: var(--fs-body);
    padding: 4px 0;
}
.card .hint-list .num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid var(--c-text-2nd); font-size: var(--fs-small);
    flex-shrink: 0;
}

/* ---------- 按钮 ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 22px; border-radius: var(--radius-btn);
    font-size: var(--fs-body); font-family: var(--font-family);
    cursor: pointer; border: 1px solid transparent;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: var(--c-primary-text); }
.btn-secondary {
    background: var(--c-card); color: var(--c-text);
    border-color: var(--c-border);
}
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: var(--fs-small); }

/* ---------- 表单 ---------- */

.input, .textarea, select.input {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--c-border); border-radius: var(--radius-btn);
    font-size: var(--fs-body); font-family: var(--font-family);
    background: var(--c-card); color: var(--c-text);
}
.input:focus, .textarea:focus { outline: 2px solid var(--c-accent); outline-offset: -1px; }
.textarea { resize: vertical; min-height: 84px; }

.form-row { margin-bottom: 16px; }
.form-row label {
    display: block; margin-bottom: 6px;
    font-size: var(--fs-body); color: var(--c-text-2nd);
}
.form-inline { display: flex; align-items: center; gap: 8px; }

.form-message { font-size: var(--fs-small); min-height: 18px; margin-top: 8px; }
.form-message.error { color: var(--c-danger); }
.form-message.success { color: var(--c-role-admin); }

/* ---------- 表格（全站统一：表头锁定、斑马纹、列宽按内容） ---------- */

.table-wrap {
    overflow: auto; border: 1px solid var(--c-border);
    border-radius: 4px; background: var(--c-card);
}
table.data-table {
    width: 100%; border-collapse: collapse;
    font-size: var(--fs-body); white-space: nowrap;
}
table.data-table thead th {
    position: sticky; top: 0; z-index: 2;       /* 表头锁定，不参与滚动 */
    background: var(--c-table-head); color: var(--c-table-head-text);
    font-weight: var(--fw-title); text-align: center;
    padding: 10px 14px; white-space: nowrap;
}
table.data-table tbody td {
    padding: 10px 14px; text-align: center;
    border-bottom: 1px solid var(--c-border);
    max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
table.data-table tbody tr:nth-child(even) { background: var(--c-table-stripe); }
table.data-table td.wrap { white-space: normal; text-align: left; }
table.data-table .thumb {
    width: 56px; height: 56px; object-fit: cover;
    border-radius: 4px; display: inline-block; vertical-align: middle;
    background: var(--c-border);
}
/* 长文本单元格：单行省略号，鼠标悬浮（title）显示全部 */
.cell-ellipsis {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    cursor: help;
}

/* 自定义悬浮气泡：替代浏览器原生 title 鐾头，样式可控、即时显示 */
.hover-tip {
    position: fixed; z-index: 1000;
    max-width: 360px;
    padding: 9px 13px;
    background: var(--c-text);
    color: var(--c-card);
    font-size: var(--fs-small); line-height: 1.6;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
    white-space: pre-wrap; word-break: break-word;
    pointer-events: none;            /* 不挡鼠标移动 */
    opacity: 0;
    transition: opacity 0.12s ease;
}
/* 夜览模式下用反色，保证对比度 */
html.night .hover-tip {
    background: var(--c-card);
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.table-empty {
    padding: 32px; text-align: center; color: var(--c-text-2nd);
}

/* ---------- 分页条（首页/上一页/页码/下一页/尾页） ---------- */

.pagination {
    display: flex; align-items: center; gap: 6px;
    margin-top: 14px; flex-wrap: wrap;
}
.pagination button {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--c-border); border-radius: 4px;
    background: var(--c-card); color: var(--c-text);
    font-size: var(--fs-body); cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--c-accent); color: var(--c-accent); }
.pagination button:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination button.current {
    background: var(--c-accent); border-color: var(--c-accent); color: #fff;
    font-weight: var(--fw-title);
}
.pagination .page-info { margin-left: auto; color: var(--c-text-2nd); font-size: var(--fs-small); }

/* ---------- 登录 / 注册 ---------- */

.auth-page {
    display: flex; min-height: 100vh; background: var(--c-sidebar-bg);
}
.auth-left {
    flex: 1.2; display: flex; flex-direction: column;
    align-items: center; justify-content: center; color: #fff;
    padding: 40px;
}
.auth-left .big-logo { width: 230px; height: 130px; object-fit: contain; }
.auth-left h1 { font-size: 34px; letter-spacing: 4px; margin-bottom: 12px; }
.auth-left p { color: var(--c-sidebar-text); font-size: var(--fs-body); letter-spacing: 2px; }
.auth-right {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: var(--c-bg); padding: 40px;
}
.auth-box { width: 100%; max-width: 360px; }
.auth-box h2 {
    font-size: var(--fs-page-title); font-weight: var(--fw-title);
    margin-bottom: 22px; text-align: center;
}
.auth-tabs { display: flex; margin-bottom: 22px; border-bottom: 1px solid var(--c-border); }
.auth-tabs button {
    flex: 1; padding: 10px; background: none; border: none;
    font-size: var(--fs-body); font-family: var(--font-family);
    color: var(--c-text-2nd); cursor: pointer;
    border-bottom: 2px solid transparent;
}
.auth-tabs button.active {
    color: var(--c-text); font-weight: var(--fw-title);
    border-bottom-color: var(--c-accent);
}
.auth-box .btn { width: 100%; padding: 10px; }

/* ---------- 展示卡（管理员设置） ---------- */

.cards-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
@media (max-width: 1100px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .cards-grid { grid-template-columns: 1fr; } }

.member-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--c-card); border-radius: var(--radius-card);
    box-shadow: var(--shadow-card); padding: 18px; position: relative;
}
.member-card .avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: #d9d9d9; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff; font-weight: var(--fw-title);
}
.member-card .info { min-width: 0; flex: 1; }
.member-card .info .nickname {
    font-size: var(--fs-body); font-weight: var(--fw-title); margin-bottom: 6px;
}
.member-card .info .join { font-size: var(--fs-small); color: var(--c-text-2nd); }
.role-tag {
    position: absolute; top: 14px; right: 14px;
    padding: 2px 10px; border-radius: 4px;
    font-size: var(--fs-small); color: #fff;
}
.role-tag.ops { background: var(--c-role-ops); }
.role-tag.admin { background: var(--c-role-admin); }
.role-tag.recorder { background: var(--c-role-recorder); }
.member-card .card-actions { margin-top: 8px; display: flex; gap: 8px; }

/* ---------- 弹窗 ---------- */

.modal-mask {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
    background: var(--c-card); border-radius: var(--radius-card);
    padding: 24px; width: 560px; max-width: 92vw;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.modal h3 { font-size: var(--fs-card-title); margin-bottom: 18px; }
.modal .modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}

/* ---------- 工具 ---------- */

.page-title { font-size: var(--fs-page-title); font-weight: var(--fw-title); margin-bottom: 16px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.text-2nd { color: var(--c-text-2nd); }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.loading { padding: 40px; text-align: center; color: var(--c-text-2nd); }

/* 开关（夜览） */
.switch { position: relative; width: 40px; height: 22px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; border-radius: 22px;
    background: #4a4a5e; cursor: pointer; transition: 0.2s;
}
.switch .slider::before {
    content: ""; position: absolute; width: 16px; height: 16px;
    left: 3px; top: 3px; border-radius: 50%;
    background: #fff; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--c-accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- 更新日志 ---------- */

.cl-item {
    border-left: 3px solid var(--c-accent);
    padding: 14px 20px;
    margin-bottom: 2px;
    background: var(--c-card);
    border-radius: 0 6px 6px 0;
}
.cl-item:hover { background: var(--c-table-stripe); }
.cl-item-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 8px;
}
.cl-date {
    font-size: 15px; font-weight: var(--fw-title); color: var(--c-text);
}
.cl-version {
    font-size: var(--fs-small); color: var(--c-accent);
    background: rgba(47, 84, 235, 0.1);
    padding: 2px 8px; border-radius: 4px;
}
.cl-del-btn { margin-left: auto; }
.cl-content {
    list-style: none; padding-left: 0;
}
.cl-content li {
    padding: 3px 0;
    font-size: var(--fs-body); color: var(--c-text-2nd);
    line-height: 1.7;
}
.cl-content li::before {
    content: "•";
    color: var(--c-accent);
    margin-right: 8px;
    font-weight: bold;
}

/* 新增日志按钮区 */
.cl-add-bar {
    margin-top: 18px; text-align: center;
}

/* 右下角浮动按钮 */
.cl-fab {
    position: fixed;
    bottom: 28px; right: 28px;
    display: flex; gap: 12px;
    z-index: 90;
}
.cl-fab-btn {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 10px 20px;
    transition: all 0.2s;
}
.cl-fab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

/* 反馈弹窗图标 */
.cl-feedback-icon {
    font-size: 32px; text-align: center; margin-bottom: 12px;
}

/* 反馈类型标签 */
.fb-type-tag {
    display: inline-block; padding: 2px 10px; border-radius: 4px;
    font-size: var(--fs-small); color: #fff;
}
.fb-type-tag.suggestion { background: var(--c-accent); }
.fb-type-tag.bug { background: var(--c-danger); }

/* ============================================================
   移动端适配（≤768px）：抽屉式侧边栏 + 工具栏换行 + 表格横向滚动
   桌面端规则完全不改动，以下仅在窄屏生效，保证零回归。
   ============================================================ */

/* 桌面端：隐藏汉堡按钮与遮罩，强制侧边栏常驻显示 */
.menu-toggle, .sidebar-mask { display: none; }
@media (min-width: 769px) {
    .sidebar { transform: none !important; }
}

@media (max-width: 768px) {
    /* ---------- 骨架 / 抽屉 ---------- */
    .topbar { justify-content: center; padding-left: 52px; padding-right: 12px; }
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        position: fixed; top: 0; left: 0;
        width: 44px; height: var(--topbar-h);
        background: none; border: none; color: #fff;
        font-size: 20px; cursor: pointer; z-index: 101;
    }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 2px 0 16px rgba(0, 0, 0, 0.3);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-mask {
        display: none;
        position: fixed; inset: var(--topbar-h) 0 0 0;
        background: rgba(0, 0, 0, 0.45); z-index: 98;
    }
    .sidebar-mask.show { display: block; }
    .main { margin-left: 0; padding: 14px 12px; }

    /* ---------- 卡片 / 工具栏 ---------- */
    .card { padding: 14px 16px; margin-bottom: 14px; }
    .page-title { font-size: 18px; }
    .card-title { font-size: 16px; }
    .toolbar { flex-wrap: wrap; gap: 8px; }
    .toolbar .spacer { display: none; }

    /* ---------- 表格 ---------- */
    .cell-ellipsis { max-width: 120px; }

    /* ---------- 分页条 ---------- */
    .pagination .page-info {
        width: 100%; text-align: center; margin: 6px 0 0;
    }

    /* ---------- 登录 / 注册页 ---------- */
    .auth-page { flex-direction: column; }
    .auth-left { display: none; }
    .auth-right { flex: 1; padding: 28px 18px; }
    .auth-box { max-width: 100%; }

    /* ---------- 更新日志 / 反馈浮动按钮 ---------- */
    .cl-fab { bottom: 16px; right: 16px; gap: 8px; }
    .cl-fab-btn { padding: 8px 14px; }

    /* ---------- 弹窗 ---------- */
    .modal {
        width: auto; padding: 18px;
        max-height: 90vh; overflow: auto;
    }
}

