:root {
    --kk-primary: #ff2e2e;
    --kk-primary-dark: #d91f1f;
    --kk-sidebar: #141a2b;
    --kk-sidebar-2: #1d2740;
    --kk-text: #1f2430;
    --kk-muted: #7b8497;
    --kk-bg: #f4f6fb;
    --kk-card: #ffffff;
    --kk-border: #e8ebf2;
    --kk-radius: 14px;
}

* { box-sizing: border-box; }

html, body, #app { height: 100%; margin: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--kk-bg);
    color: var(--kk-text);
    -webkit-font-smoothing: antialiased;
}

/* ================= 登录 ================= */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 46, 46, .20), transparent 36%),
        radial-gradient(circle at 88% 82%, rgba(64, 120, 255, .22), transparent 38%),
        linear-gradient(135deg, #0e1322 0%, #1b2540 52%, #111827 100%);
    padding: 24px;
}

.login-card {
    width: 420px;
    max-width: 100%;
    background: rgba(255, 255, 255, .97);
    border-radius: 20px;
    padding: 38px 36px 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .38);
}

.login-logo {
    width: 54px; height: 54px; border-radius: 16px;
    background: linear-gradient(135deg, var(--kk-primary), #ff7a45);
    color: #fff; font-size: 24px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 18px;
    box-shadow: 0 10px 24px rgba(255, 46, 46, .35);
}

.login-title { font-size: 24px; font-weight: 800; letter-spacing: .5px; }
.login-sub { color: var(--kk-muted); font-size: 13px; margin: 8px 0 26px; line-height: 1.7; }
.login-tip { margin-top: 18px; font-size: 12px; color: #9aa3b5; line-height: 1.8; }
.login-tip b { color: #5b45ff; }

/* ================= 布局 ================= */
.app-shell { height: 100vh; }

.kk-aside {
    background: linear-gradient(180deg, var(--kk-sidebar) 0%, var(--kk-sidebar-2) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width .2s ease;
    overflow: hidden;
}

.kk-brand {
    height: 72px;
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0;
}

.kk-brand-logo {
    width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--kk-primary), #ff8a3d);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff; font-size: 16px;
}

.kk-brand-text { font-size: 15px; font-weight: 700; white-space: nowrap; }
.kk-brand-text small { display: block; font-size: 10px; color: #8b96ad; font-weight: 400; letter-spacing: 1px; margin-top: 2px; }

.kk-menu { border-right: none !important; background: transparent !important; padding: 12px 10px; flex: 1; overflow-y: auto; }
.kk-menu .el-menu-item {
    color: #b6c0d4 !important;
    height: 44px;
    line-height: 44px;
    margin: 4px 0;
    border-radius: 10px;
    font-size: 14px;
}
.kk-menu .el-menu-item:hover { background: rgba(255, 255, 255, .07) !important; color: #fff !important; }
.kk-menu .el-menu-item.is-active {
    background: linear-gradient(90deg, rgba(255, 46, 46, .95), rgba(255, 92, 60, .78)) !important;
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(255, 46, 46, .28);
}
.kk-menu .el-menu-item .mi {
    display: inline-flex; width: 22px; height: 22px; border-radius: 6px;
    align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .08);
    font-size: 11px; margin-right: 10px; font-weight: 700;
}
.kk-menu .el-menu-item.is-active .mi { background: rgba(255, 255, 255, .22); }

.kk-aside-foot { padding: 14px 20px 18px; color: #6f7a90; font-size: 11px; line-height: 1.7; border-top: 1px solid rgba(255,255,255,.06); }

.kk-header {
    height: 66px;
    background: #fff;
    border-bottom: 1px solid var(--kk-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px;
    gap: 16px;
}

.kk-header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.kk-page-title { font-size: 17px; font-weight: 700; white-space: nowrap; }
.kk-page-desc { font-size: 12px; color: var(--kk-muted); margin-top: 2px; }

.kk-header-right { display: flex; align-items: center; gap: 12px; }

.kk-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 8px; border-radius: 10px; }
.kk-user:hover { background: #f6f7fb; }
.kk-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #ff2e2e, #ff8a3d);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.kk-user-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.kk-user-sub { font-size: 11px; color: var(--kk-muted); }

.kk-main { padding: 20px 22px 30px; overflow-y: auto; }

/* ================= 通用 ================= */
.kk-card {
    background: var(--kk-card);
    border: 1px solid var(--kk-border);
    border-radius: var(--kk-radius);
    padding: 18px 20px;
    box-shadow: 0 2px 10px rgba(20, 26, 43, .03);
}
.kk-card + .kk-card { margin-top: 16px; }
.kk-card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kk-card-title small { font-weight: 400; color: var(--kk-muted); font-size: 12px; }

.kk-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.kk-toolbar .spacer { flex: 1; }

/* 小程序切换条：站点配置 / 广告配置 共用同一份选择 */
.kk-picker {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-bottom: 12px; padding: 12px 14px;
    background: #fff8f7; border: 1px solid #ffe2df; border-radius: 10px;
}
.kk-picker-label { font-size: 13px; font-weight: 700; color: #c02b23; }
.kk-picker-tip { font-size: 12px; color: var(--kk-muted); }

.kk-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.kk-stat {
    position: relative; overflow: hidden;
    background: #fff; border: 1px solid var(--kk-border); border-radius: var(--kk-radius);
    padding: 18px 18px 16px;
}
.kk-stat::after {
    content: ""; position: absolute; right: -26px; top: -26px; width: 86px; height: 86px; border-radius: 50%;
    background: rgba(255, 46, 46, .07);
}
.kk-stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.kk-stat-label { font-size: 12px; color: var(--kk-muted); margin-top: 4px; }
.kk-stat-icon {
    position: absolute; right: 16px; bottom: 14px; width: 34px; height: 34px; border-radius: 10px;
    background: #fff2f0; color: var(--kk-primary); display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 800;
}

.kk-cover { width: 62px; height: 44px; border-radius: 8px; object-fit: cover; background: #eef1f6; display: block; }
.kk-title-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kk-title-main { font-size: 13px; font-weight: 600; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kk-title-sub { font-size: 11px; color: var(--kk-muted); margin-top: 3px; }

.kk-pager { display: flex; justify-content: flex-end; margin-top: 16px; }

.kk-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; line-height: 20px; }
.kk-tag.red { background: #fff1f0; color: #e8422f; }
.kk-tag.blue { background: #eef4ff; color: #2f6bff; }
.kk-tag.gray { background: #f1f3f7; color: #6b7385; }
.kk-tag.green { background: #ecfdf3; color: #12805c; }

.kk-empty { padding: 40px 0; text-align: center; color: var(--kk-muted); font-size: 13px; }

.kk-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kk-image-item { border: 1px solid var(--kk-border); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; transition: .18s; }
.kk-image-item:hover { border-color: var(--kk-primary); box-shadow: 0 8px 22px rgba(255, 46, 46, .12); }
.kk-image-item img { width: 100%; height: 108px; object-fit: cover; display: block; background: #f2f4f8; }
.kk-image-meta { padding: 8px 10px; font-size: 10px; color: var(--kk-muted); word-break: break-all; line-height: 1.5; }

.kk-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.kk-form-grid .full { grid-column: 1 / -1; }

.kk-dialog-cover { display: flex; gap: 12px; align-items: flex-start; }
.kk-dialog-cover img { width: 110px; height: 78px; border-radius: 10px; object-fit: cover; background: #eef1f6; border: 1px solid var(--kk-border); }

.kk-chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.kk-chart-name { width: 92px; color: var(--kk-muted); text-align: right; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kk-chart-track { flex: 1; height: 8px; border-radius: 999px; background: #f1f3f8; overflow: hidden; }
.kk-chart-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff2e2e, #ff8a3d); }
.kk-chart-num { width: 42px; text-align: right; font-weight: 600; }

.kk-mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.kk-muted { color: var(--kk-muted); }
.kk-danger { color: #e8422f; }
.kk-mt { margin-top: 16px; }
.kk-flex { display: flex; gap: 12px; align-items: center; }
.kk-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 900px) {
    .kk-aside { position: fixed; z-index: 30; height: 100vh; }
    .kk-main { padding: 14px; }
    .kk-form-grid { grid-template-columns: 1fr; }
}
