/* ==========================================================================
   QQ 群运营系统 · 后台样式
   ========================================================================== */

:root {
    --ink: #0f1e33;
    --ink2: #5b6b82;
    --ink3: #8a99ad;
    --line: #e6ecf5;
    --bg: #f4f7fc;
    --blue: #2f6fed;
    --blue-d: #1b52c4;
    --green: #12b886;
    --red: #e5484d;
    --amber: #e9a23b;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(15, 30, 51, .06);
    --shadow-lg: 0 16px 40px rgba(15, 30, 51, .12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
}

h1, h2, h3, h4, p {
    margin: 0;
}

/* ============================== 顶栏 ============================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #4a8dff, #12b886);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 6px 14px rgba(47, 111, 237, .28);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--ink2);
}

.who {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* 移动端菜单按钮：桌面隐藏，宽度 <=900px 时出现 */
.nav-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.nav-mask {
    display: none;
}

/* ============================== 布局 ============================== */

.layout {
    display: flex;
    min-height: calc(100vh - 60px);
}

.side {
    flex: 0 0 208px;
    background: linear-gradient(180deg, #0d1a2b, #14293f);
    padding: 16px 12px 24px;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.side nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, .72);
    font-size: 14px;
    margin-bottom: 4px;
    transition: .18s;
}

.side nav a:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.side nav a.on {
    background: linear-gradient(90deg, rgba(74, 141, 255, .22), rgba(18, 184, 134, .08));
    color: #fff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #4a8dff;
}

.side .side-title {
    color: rgba(255, 255, 255, .38);
    font-size: 12px;
    letter-spacing: .14em;
    padding: 14px 12px 8px;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 22px 24px 40px;
}

/* ============================== 卡片 ============================== */

.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.card-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid #f0f4fa;
}

.card-hd h3 {
    font-size: 15px;
    font-weight: 700;
}

.card-bd {
    padding: 18px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ============================== KPI ============================== */

.kpi {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.kpi::after {
    content: "";
    position: absolute;
    right: -18px;
    top: -18px;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(47, 111, 237, .12), transparent 70%);
}

.kpi-label {
    font-size: 13px;
    color: var(--ink3);
    margin-bottom: 6px;
}

.kpi-num {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.kpi-num small {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink3);
    margin-left: 6px;
}

/* ============================== 按钮 ============================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 15px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 13.5px;
    cursor: pointer;
    transition: .18s;
    white-space: nowrap;
    background: none;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #4a8dff, #2f6fed);
    color: #fff;
    box-shadow: 0 8px 18px rgba(47, 111, 237, .24);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(47, 111, 237, .32);
}

.btn-ghost {
    background: #fff;
    border-color: #dbe4f1;
    color: var(--ink2);
}

.btn-ghost:hover {
    border-color: #b7ccef;
    color: var(--blue);
}

.btn-danger {
    background: #fff;
    border-color: #f7d5d6;
    color: var(--red);
}

.btn-danger:hover {
    background: #fff5f5;
}

.btn-sm {
    height: 30px;
    padding: 0 11px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

/* ============================== 表格 ============================== */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    text-align: left;
    font-weight: 600;
    color: var(--ink2);
    background: #f8fafd;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f2f6fb;
    vertical-align: middle;
    color: #2b3b52;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fbfdff;
}

.table .muted {
    color: var(--ink3);
    font-size: 12.5px;
}

.table .num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.empty {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink3);
    font-size: 13.5px;
}

.empty-ico {
    width: 54px;
    height: 54px;
    margin: 0 auto 12px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eff5ff, #e9faf4);
    color: #9db6d6;
    font-size: 22px;
}

/* ============================== 标签 ============================== */

.tag {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: 6px;
    font-size: 12px;
    background: #eff4fb;
    color: var(--ink2);
    white-space: nowrap;
}

.tag-ok {
    background: #e8f8f1;
    color: #0e9b72;
}

.tag-warn {
    background: #fdf3e4;
    color: #b97a13;
}

.tag-bad {
    background: #fdecec;
    color: #c93b3f;
}

.tag-gray {
    background: #f1f4f9;
    color: #7a8798;
}

/* ============================== 表单 ============================== */

.form {
    max-width: 720px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row > label {
    display: block;
    font-size: 13px;
    color: var(--ink2);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-row > label .req {
    color: var(--red);
    margin-left: 2px;
}

.input,
.select,
.textarea {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #dbe4f1;
    border-radius: 9px;
    background: #fff;
    font-size: 13.5px;
    color: var(--ink);
    font-family: inherit;
    transition: .16s;
}

.textarea {
    height: auto;
    min-height: 96px;
    padding: 10px 12px;
    line-height: 1.7;
    resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: #8fb6ff;
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}

.hint {
    font-size: 12.5px;
    color: var(--ink3);
    margin-top: 6px;
    line-height: 1.6;
}

.hint code,
.code {
    background: #f5f8fd;
    border: 1px solid #e6ecf5;
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 12px;
    color: var(--blue-d);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.form-actions {
    display: flex;
    gap: 10px;
    padding-top: 6px;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================== 分页 ============================== */

.pagination {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 4px 0 0;
    padding: 14px 18px;
    flex-wrap: wrap;
}

.pagination li {
    list-style: none;
}

.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    border: 1px solid #e0e8f4;
    background: #fff;
    color: var(--ink2);
    font-size: 13px;
}

.pagination li.active span {
    background: linear-gradient(135deg, #4a8dff, #2f6fed);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.pagination li.disabled span {
    color: #c3cedd;
    background: #fafcff;
}

/* ============================== 登录页 ============================== */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #071428;
    background-image:
        radial-gradient(720px 460px at 82% 12%, rgba(47, 111, 237, .34), transparent 66%),
        radial-gradient(600px 400px at 8% 96%, rgba(18, 184, 134, .22), transparent 64%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 18px;
    padding: 32px 30px 28px;
    box-shadow: 0 30px 70px rgba(3, 12, 26, .4);
}

.login-card h1 {
    font-size: 19px;
    font-weight: 800;
    margin-bottom: 4px;
}

.login-card p.sub {
    font-size: 13px;
    color: var(--ink3);
    margin-bottom: 22px;
}

/* ============================== Toast ============================== */

#qg-toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translate(-50%, 20px);
    min-width: 180px;
    max-width: 80vw;
    padding: 11px 18px;
    border-radius: 11px;
    background: rgba(15, 30, 51, .92);
    color: #fff;
    font-size: 13.5px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: .24s;
    z-index: 90;
    backdrop-filter: blur(8px);
}

#qg-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

#qg-toast.err {
    background: rgba(190, 40, 44, .94);
}

/* ============================== 落地页预览卡 ============================== */

.page-preview {
    display: flex;
    gap: 14px;
    align-items: center;
}

.page-thumb {
    width: 92px;
    height: 62px;
    border-radius: 9px;
    object-fit: cover;
    background: linear-gradient(135deg, #eef4ff, #e9faf4);
    border: 1px solid var(--line);
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: #9db6d6;
    font-size: 12px;
}

.page-meta {
    min-width: 0;
}

.page-meta b {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

/* ============================== 响应式 ============================== */

@media (max-width: 1180px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    /* 手机上侧栏改为抽屉：点顶栏「菜单」按钮滑出，点遮罩或菜单项收起 */
    .nav-toggle {
        display: inline-flex;
    }

    /* 顶栏收紧：只留 logo 图标，避免站点名换行把按钮挤走 */
    .topbar {
        padding: 0 12px;
    }

    .topbar-right {
        gap: 8px;
        min-width: 0;
    }

    .brand span:last-child {
        display: none;
    }

    .who {
        max-width: 96px;
    }

    /* 手机上省掉角色标签，把空间留给名字和按钮 */
    .who .tag {
        display: none;
    }

    .layout {
        display: block;
    }

    .side {
        position: fixed;
        top: 0;
        left: 0;
        width: 232px;
        height: 100vh;
        z-index: 60;
        padding: 16px 12px 24px;
        transform: translateX(-100%);
        transition: transform .22s ease;
        overflow-y: auto;
        box-shadow: 0 0 24px rgba(0, 0, 0, .25);
    }

    body.nav-open .side {
        transform: translateX(0);
    }

    .nav-mask {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(8, 18, 32, .5);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    body.nav-open .nav-mask {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        padding: 16px 14px 32px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .grid-4 {
        grid-template-columns: 1fr;
    }
}
