:root {
    --bg: #F5F7FA;
    --card: #FBFCFE;
    --ink: #16181D;
    --body: #333A45;
    --muted: #6C7480;
    --faint: #9AA1AC;
    --line: rgba(22, 24, 29, 0.08);
    --blue: #2F6FEB;
    --danger: #B23A2E;
}

* { box-sizing: border-box; }

/* hidden 属性优先级高于组件自身的 display */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: linear-gradient(180deg, #D6E8FA 0, #EEF3FA 220px, var(--bg) 480px);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.3px; }
p { margin: 0; }
button { font-family: inherit; }

/* ---------- 登录 ---------- */
.login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    padding: 32px;
    background: var(--card);
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(22, 40, 74, 0.12);
}
.brand-mark {
    width: 56px; height: 56px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2F6FEB, #0B2A66);
    color: #FBFCFE; font-size: 24px; font-weight: 700;
    border-radius: 50%;
    margin-bottom: 16px;
}
.brand-mark.small { width: 38px; height: 38px; font-size: 17px; margin: 0 10px 0 0; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 12px; }

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); }
textarea { resize: vertical; }
label { display: block; margin: 16px 0 6px; font-size: 12px; color: var(--muted); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #F2F5FA; }
.btn.primary { background: var(--ink); color: #FBFCFE; border-color: var(--ink); }
.btn.primary:hover { background: #24272F; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(178, 58, 46, 0.3); background: transparent; }
.btn.block { width: 100%; margin-top: 20px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 主框架 ---------- */
.app { min-height: 100vh; padding-bottom: 48px; }
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 32px;
    max-width: 1240px;
    margin: 0 auto;
}
.brand { display: flex; align-items: center; }
.brand-name { font-weight: 700; letter-spacing: -0.3px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex: 1; }
.tabs button {
    padding: 8px 18px;
    font-size: 14px;
    color: var(--body);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
}
.tabs button:hover { background: rgba(22, 24, 29, 0.05); }
.tabs button.on { background: var(--ink); color: #FBFCFE; font-weight: 600; }

main { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

.panel {
    background: var(--card);
    border-radius: 18px;
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: 0 8px 26px rgba(22, 40, 74, 0.06);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.panel-head h2 { font-size: 16px; }
.actions { display: flex; gap: 10px; align-items: center; }
.actions input { width: 220px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat {
    background: var(--card);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 8px 26px rgba(22, 40, 74, 0.06);
}
.stat .num { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.notes { margin: 0; padding-left: 18px; color: var(--body); }
.notes li { margin-bottom: 6px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid rgba(22, 24, 29, 0.05); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table .title-cell { max-width: 320px; }
.table .title-cell b { font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
}
.mini.danger { color: var(--danger); border-color: rgba(178, 58, 46, 0.28); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.pill.free { background: rgba(47, 111, 235, 0.1); color: var(--blue); }
.pill.preview { background: rgba(180, 120, 10, 0.12); color: #8A5A08; }
.pill.paid { background: rgba(22, 24, 29, 0.1); color: var(--ink); }
.pill.draft { background: rgba(22, 24, 29, 0.06); color: var(--muted); }
.pill.published { background: rgba(15, 118, 110, 0.1); color: #0F766E; }
.pill.paid-order { background: rgba(15, 118, 110, 0.1); color: #0F766E; }
.pill.pending { background: rgba(180, 120, 10, 0.12); color: #8A5A08; }

.empty { padding: 40px 0; text-align: center; color: var(--faint); }

/* ---------- 抽屉 ---------- */
.drawer-mask {
    position: fixed; inset: 0;
    background: rgba(16, 22, 31, 0.32);
    backdrop-filter: blur(2px);
}
.drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(520px, 100%);
    background: var(--card);
    padding: 22px 24px 32px;
    overflow-y: auto;
    box-shadow: -20px 0 60px rgba(16, 22, 31, 0.18);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-head h2 { font-size: 18px; }
.form { padding-bottom: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drawer-actions { display: flex; gap: 12px; margin-top: 26px; }
.drawer-actions .btn { flex: 1; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    transform: translateX(-50%) translateY(10px);
    background: var(--ink);
    color: #FBFCFE;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 820px) {
    .topbar { flex-wrap: wrap; gap: 12px; padding: 14px 18px; }
    main { padding: 0 18px; }
    .grid2 { grid-template-columns: 1fr; }
    .actions input { width: 140px; }
}

/* ---------- 漏斗与分页 ---------- */
.funnel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.funnel-step {
    padding: 16px 18px;
    background: #F2F5FA;
    border-radius: 14px;
}

.funnel-num {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--ink);
}

.funnel-label {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
}

.funnel-rate {
    margin-top: 6px;
    font-size: 12px;
    color: var(--blue);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.pager-info {
    font-size: 12px;
    color: var(--muted);
}

.actions select {
    width: auto;
    min-width: 120px;
}
