/* ============================================================
   BrandGEO 服务器版 - 公共样式 v4「大气版」
   深色渐变侧边栏 · 渐变主色 · 大留白 · 移动端自适应
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --side-w: 232px;
    --brand: #2563eb;
    --brand-deep: #1d4ed8;
    --grad: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --grad-soft: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f5f7fb;
    --card: #ffffff;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
    --shadow-lift: 0 4px 12px rgba(37, 99, 235, .12), 0 12px 32px rgba(15, 23, 42, .08);
}
body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg); color: var(--ink);
    display: flex; min-height: 100vh; font-size: 14px;
}

/* ============ 侧边栏 ============ */
.sidebar {
    width: var(--side-w); position: fixed; inset: 0 auto 0 0; z-index: 20;
    background: linear-gradient(180deg, #0b1633 0%, #101c3d 55%, #131f45 100%);
    display: flex; flex-direction: column; color: #cbd5e1;
    overflow: hidden;                 /* 菜单溢出不再跑到视口外 */
}
.logo { font-size: 24px; font-weight: 800; padding: 20px 22px 2px; letter-spacing: .5px; color: #fff; flex: none; }
.logo span {
    background: linear-gradient(90deg, #60a5fa, #c084fc);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-tag {
    padding: 4px 22px 12px; color: #7d8db1; font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .08); margin-bottom: 8px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none;
}
/* 菜单区：占满剩余高度并在内容超额时纵向滚动（min-height:0 是让 flex 子项可收缩的关键） */
.sidebar nav {
    padding: 4px 12px 10px; display: flex; flex-direction: column; gap: 3px;
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, .32) transparent;
    scrollbar-gutter: stable;
}
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, .3); border-radius: 3px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .55); }
.sidebar nav a {
    padding: 10px 14px; border-radius: 10px; color: #aab6d3;
    text-decoration: none; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px; flex: none;
    transition: background .15s, color .15s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active {
    background: var(--grad); color: #fff;
    box-shadow: 0 6px 18px rgba(79, 109, 245, .45);
}
.sidebar-foot { padding: 16px 18px; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: var(--grad); color: #fff; font-weight: 700; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.user-chip .u-name { font-size: 13px; color: #e2e8f0; font-weight: 600; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: #7d8db1; }
.btn-logout {
    display: block; text-align: center; text-decoration: none; font-size: 12px;
    padding: 7px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18);
    color: #aab6d3; background: transparent; cursor: pointer;
}
.btn-logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ============ 主区 ============ */
main { margin-left: var(--side-w); flex: 1; padding: 30px 38px 56px; width: calc(100% - var(--side-w)); min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: .3px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 5px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.flash {
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46;
    border-radius: 10px; padding: 11px 16px; font-size: 13px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}

/* ============ 卡片 / 统计 ============ */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.card h3 { font-size: 16px; margin-bottom: 16px; font-weight: 700; }
.grid { display: grid; gap: 18px; }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; align-items: center; gap: 16px; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.stat-icon {
    width: 50px; height: 50px; border-radius: 14px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
    background: var(--grad-soft);
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat .label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ============ 顶部欢迎横幅 ============ */
.hero {
    background: var(--grad); border-radius: 18px; padding: 28px 30px;
    color: #fff; margin-bottom: 24px; position: relative; overflow: hidden;
    box-shadow: 0 12px 32px rgba(79, 109, 245, .3);
}
.hero::after {
    content: ''; position: absolute; right: -60px; top: -80px;
    width: 260px; height: 260px; border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}
.hero h2 { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.hero p { font-size: 13px; opacity: .85; margin-bottom: 18px; }
.hero .quick { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .quick a {
    padding: 9px 18px; border-radius: 10px; font-size: 13px; font-weight: 600;
    text-decoration: none; color: #fff; background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(4px);
    transition: background .15s;
}
.hero .quick a:hover { background: rgba(255, 255, 255, .28); }
.hero .quick a.primary { background: #fff; color: var(--brand-deep); border-color: #fff; }

/* ============ 新手引导步骤条 ============ */
.guide { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.guide .g-step {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 16px; display: flex; gap: 12px; align-items: center;
    text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s;
}
.guide .g-step:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.g-step .g-no {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: #eef2f7; color: var(--muted); font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.g-step.done .g-no { background: #10b981; color: #fff; }
.g-step .g-t { font-size: 13.5px; font-weight: 600; }
.g-step .g-s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.g-step.done .g-s { color: #059669; }

/* ============ 表格 ============ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px;
    border-bottom: 1px solid var(--line); white-space: nowrap; background: #f8fafc;
}
th:first-child { border-radius: 8px 0 0 0; }
td { padding: 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
tbody tr:hover td { background: #f8fafc; }

/* ============ 按钮 / 表单 ============ */
.btn {
    background: var(--grad); color: #fff; border: none; border-radius: 10px;
    padding: 9px 18px; cursor: pointer; font-size: 13px; font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 109, 245, .3);
    transition: filter .15s, transform .1s; text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; box-shadow: none; }
.btn-outline {
    background: #fff; color: var(--brand); border: 1px solid #bfdbfe; box-shadow: none;
}
.btn-outline:hover { background: #eff6ff; filter: none; }
.btn-danger { background: #fee2e2; color: #dc2626; border: none; box-shadow: none; }
.btn-danger:hover { background: #fecaca; filter: none; }
input, select, textarea {
    border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
    font-size: 13px; font-family: inherit; width: 100%; background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; font-weight: 600; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.chk { display: inline-flex; align-items: center; gap: 5px; margin: 3px 10px 3px 0; font-size: 13px; color: var(--ink-2); }
.chk input { width: auto; }

/* ============ 标签 ============ */
.tag {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600; background: #eff6ff; color: var(--brand); margin: 1px 2px;
}
.tag.gray { background: #f1f5f9; color: var(--muted); }
.tag.green { background: #d1fae5; color: #059669; }
.tag.red { background: #fee2e2; color: #dc2626; }
.tag.orange { background: #fef3c7; color: #d97706; }

.hit { color: #059669; font-weight: 700; }
.miss { color: #d7dee8; }
.bar-wrap { background: #eef2f7; border-radius: 6px; height: 8px; overflow: hidden; }
.bar { height: 100%; background: var(--grad); border-radius: 6px; }

/* ============ 登录页 ============ */
.login-body {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0b1633 0%, #1d2f6b 55%, #3b2f77 100%);
    min-height: 100vh; padding: 20px;
}
.login-card {
    background: #fff; border-radius: 20px; padding: 44px 42px 36px; width: 420px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.login-card .logo { padding: 0; text-align: center; font-size: 28px; color: var(--ink); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 30px; }
.login-card .btn { padding: 12px; font-size: 14px; }
.hint {
    margin-top: 26px; padding: 14px 16px; background: var(--grad-soft);
    border: 1px solid #dbeafe; border-radius: 12px; font-size: 12px;
    color: var(--ink-2); line-height: 2;
}
.login-deco { text-align: center; color: rgba(255, 255, 255, .55); font-size: 12px; margin-top: 22px; letter-spacing: 1px; }

/* ============ 公开 FAQ 页 ============ */
.faq-body { display: block; background: #fff; }
.faq-wrap { max-width: 780px; margin: 0 auto; padding: 48px 20px; }
.faq-item { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.faq-item .q { font-weight: 700; font-size: 15.5px; margin-bottom: 8px; }
.faq-item .a { font-size: 14px; line-height: 1.9; color: var(--ink-2); }

/* ============ v2：渠道资源库 ============ */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tabs a {
    padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
    color: var(--ink-2); text-decoration: none; font-size: 13px; background: #fff; font-weight: 500;
}
.tabs a:hover { border-color: var(--brand); color: var(--brand); }
.tabs a.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79, 109, 245, .25); }

.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ch-card {
    border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
    display: flex; flex-direction: column; gap: 8px; background: #fbfcfe;
    transition: transform .15s, box-shadow .15s;
}
.ch-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.ch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ch-head b { font-size: 14.5px; }
.ch-meta { font-size: 12px; color: var(--muted); }
.ch-tips { font-size: 12px; color: var(--ink-2); line-height: 1.6; background: #eff6ff; border-radius: 8px; padding: 9px 11px; }
.ch-rules summary { font-size: 12px; color: var(--brand); cursor: pointer; }
.ch-rules div { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 6px; background: #f8fafc; border-radius: 8px; padding: 9px 11px; }
.ch-links { display: flex; gap: 8px; margin-top: auto; }
.stars { font-size: 13px; color: #f59e0b; white-space: nowrap; }
.stars i { font-style: normal; color: #d1d5db; }

/* ============ v2：起草弹层 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(11, 22, 51, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px); }
.modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 660px; max-height: 90vh;
    display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-x { border: none; background: none; font-size: 17px; color: #94a3b8; cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.draft-tip { margin-top: 10px; font-size: 12px; color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; padding: 9px 11px; line-height: 1.7; }

/* ============ 移动端自适应 ============ */
.topbar { display: none; }
@media (max-width: 920px) {
    .sidebar {
        position: fixed; top: 0; left: 0; right: 0; bottom: auto; width: 100%;
        flex-direction: row; align-items: center; padding: 0 14px; height: 54px; gap: 6px;
    }
    .logo { padding: 0; font-size: 19px; flex: none; }
    .logo span { color: #93c5fd; background: none; -webkit-text-fill-color: #93c5fd; }
    .brand-tag, .sidebar-foot { display: none; }
    .sidebar nav {
        flex-direction: row; padding: 0; gap: 2px; flex: 1 1 auto; min-width: 0;
        overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scrollbar-gutter: auto;
    }
    .sidebar nav::-webkit-scrollbar { display: none; }
    .nav-fade { display: none !important; }
    .sidebar nav a { padding: 7px 11px; font-size: 13px; white-space: nowrap; border-radius: 8px; }
    .topbar { display: flex; }
    main { margin-left: 0; padding: 68px 16px 40px; }
    .grid.c4 { grid-template-columns: repeat(2, 1fr); }
    .guide { grid-template-columns: 1fr 1fr; }
    .hero { padding: 22px 20px; }
    .hero h2 { font-size: 18px; }
}
@media (max-width: 560px) {
    .grid.c4 { grid-template-columns: 1fr 1fr; gap: 12px; }
    .guide { grid-template-columns: 1fr; }
    .stat .num { font-size: 24px; }
    .stat-icon { width: 42px; height: 42px; font-size: 20px; }
    main { padding: 64px 12px 32px; }
    .card { padding: 16px; }
    table { font-size: 12px; }
    td, th { padding: 8px 6px; }
}
@media print { .sidebar, .topbar, .page-actions, .btn { display: none !important; } main { margin: 0; padding: 0; } }
