/* ==========================================================
   薯芯云授权中心 - 全局样式
   设计风格：简约白色 / 企业级 / 蓝色主题
   ========================================================== */

:root {
    --brand:        #1763f5;
    --brand-dark:   #0f4cd0;
    --brand-light:  #eaf1ff;
    --brand-glow:   rgba(23, 99, 245, .16);

    --bg:           #f6f8fc;
    --surface:      #ffffff;
    --surface-2:    #fafbfd;
    --border:       #e8ecf3;
    --border-strong:#d8dfea;

    --text:         #1a2233;
    --text-2:       #54617a;
    --text-3:       #8b97ae;

    --success:      #17a673;
    --success-bg:   #e8f8f2;
    --warning:      #e08700;
    --warning-bg:   #fff5e5;
    --danger:       #e0454c;
    --danger-bg:    #fdecec;
    --info:         #2b7fff;
    --info-bg:      #eaf3ff;

    --radius:       12px;
    --radius-sm:    8px;
    --radius-lg:    18px;

    --shadow-xs:    0 1px 2px rgba(20, 35, 70, .04);
    --shadow-sm:    0 2px 8px rgba(20, 35, 70, .06);
    --shadow:       0 6px 22px rgba(20, 35, 70, .08);
    --shadow-lg:    0 16px 48px rgba(20, 35, 70, .12);

    --sidebar-w:    240px;
    --header-h:     62px;
    --transition:   .18s cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4, h5, h6 { margin: 0 0 .6em; font-weight: 600; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }

img { max-width: 100%; }

/* ---------- 图标 ---------- */
.ico { display: inline-block; vertical-align: -0.16em; flex-shrink: 0; }

/* ==========================================================
   顶部导航（前台）
   ========================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
    white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; }
.brand .brand-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: .5px;
    padding-left: 2px;
}

.nav-main { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-main a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    white-space: nowrap;
}
.nav-main a:hover { background: var(--surface-2); color: var(--text); }
.nav-main a.active { background: var(--brand-light); color: var(--brand); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

/* ==========================================================
   容器 / 布局
   ========================================================== */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 22px; }
.container-narrow { max-width: 760px; }
.container-mid { max-width: 1000px; }

.page { padding: 30px 0 60px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .sub { color: var(--text-3); font-size: 13px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.text-lg { font-size: 16px; }
.fw-600 { font-weight: 600; }

/* ==========================================================
   卡片
   ========================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ico { color: var(--brand); }
.card-body { padding: 20px; }
.card-body.tight { padding: 14px 16px; }
.card-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- 统计卡 ---------- */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-light);
    color: var(--brand);
    flex-shrink: 0;
}
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.blue   { background: var(--info-bg);    color: var(--info); }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-3); margin-bottom: 3px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); }
.stat-trend { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ==========================================================
   按钮
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    text-decoration: none;
    user-select: none;
}
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px var(--brand-glow); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; box-shadow: 0 4px 14px var(--brand-glow); transform: translateY(-1px); }

.btn-default { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-default:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); color: var(--text); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #12915f; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c93a41; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #c47500; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 13px 28px; font-size: 15.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 6px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================
   表单
   ========================================================== */
.form-group { margin-bottom: 17px; }
.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 7px;
    color: var(--text);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-label .hint { font-weight: 400; color: var(--text-3); font-size: 12.5px; margin-left: 6px; }

.form-control {
    width: 100%;
    padding: 10px 13px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control::placeholder { color: #a9b3c6; }
.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
select.form-control { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b97ae' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; line-height: 1.65; }

.form-hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.form-error { font-size: 12.5px; color: var(--danger); margin-top: 5px; display: flex; align-items: center; gap: 4px; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }

.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .form-control { padding-left: 40px; }
.input-icon.has-suffix .form-control { padding-right: 42px; }
.input-icon .suffix {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    color: var(--text-3); cursor: pointer; padding: 5px; border-radius: 6px;
    background: none; border: none; display: flex;
}
.input-icon .suffix:hover { color: var(--text); background: var(--surface-2); }

/* 复选框 / 单选框 */
.checkbox, .radio { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.checkbox input, .radio input { margin: 3px 0 0; accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; cursor: pointer;
    background: #ccd4e0; border-radius: 24px; transition: var(--transition);
}
.switch .slider:before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* 支付方式选择 */
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pay-method {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 15px; border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition);
    background: var(--surface);
}
.pay-method:hover { border-color: var(--brand); }
.pay-method input { display: none; }
.pay-method.selected { border-color: var(--brand); background: var(--brand-light); box-shadow: 0 0 0 3px var(--brand-glow); }
.pay-method .pm-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; font-weight: 700; }
.pay-method .pm-icon.alipay { background: #1677ff; }
.pay-method .pm-icon.wxpay  { background: #07c160; }
.pay-method .pm-icon.qqpay  { background: #12b7f5; }
.pay-method .pm-name { font-weight: 500; font-size: 13.5px; }

/* ==========================================================
   徽章 / 状态
   ========================================================== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; font-size: 12px; font-weight: 500;
    border-radius: 20px; line-height: 1.7; white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-muted   { background: #eef1f6;           color: var(--text-3); }
.badge-brand   { background: var(--brand-light); color: var(--brand); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ==========================================================
   表格
   ========================================================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; padding: 12px 14px; font-weight: 600; font-size: 12.5px;
    color: var(--text-2); background: var(--surface-2);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table .mono { font-family: "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace; font-size: 12.5px; letter-spacing: -.2px; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.table-empty .ico { width: 40px; height: 40px; color: #c8d1e0; margin-bottom: 10px; }

/* ==========================================================
   标签页
   ========================================================== */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button {
    padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text-2);
    border: none; background: none; cursor: pointer; font-family: inherit;
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
    transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11.5px; background: var(--border); color: var(--text-2); padding: 0 6px; border-radius: 10px; }
.tabs .active .count { background: var(--brand-light); color: var(--brand); }

/* 胶囊筛选 */
.pills { display: flex; gap: 7px; flex-wrap: wrap; }
.pill {
    padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
    cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.pill:hover { border-color: var(--brand); color: var(--brand); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ==========================================================
   提示框
   ========================================================== */
.alert {
    display: flex; gap: 11px; padding: 13px 16px;
    border-radius: var(--radius-sm); font-size: 13.5px;
    border: 1px solid transparent; margin-bottom: 18px; line-height: 1.65;
}
.alert .ico { margin-top: 2px; flex-shrink: 0; }
.alert-info    { background: var(--info-bg);    border-color: #cfe2ff; color: #1a5fb4; }
.alert-success { background: var(--success-bg); border-color: #c3ecd9; color: #0d7a52; }
.alert-warning { background: var(--warning-bg); border-color: #ffe0b2; color: #97550a; }
.alert-danger  { background: var(--danger-bg);  border-color: #f8d0d1; color: #b02830; }

/* ==========================================================
   分页
   ========================================================== */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.pager ul { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pager li a, .pager li span {
    display: flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 10px;
    border: 1px solid var(--border-strong); border-radius: 8px;
    font-size: 13.5px; color: var(--text-2); background: var(--surface);
    transition: all var(--transition);
}
.pager li a:hover { border-color: var(--brand); color: var(--brand); }
.pager li.active a, .pager li.active span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager li.dots { padding: 0 4px; color: var(--text-3); align-self: center; }
.pager-info { font-size: 12.5px; color: var(--text-3); }

/* ==========================================================
   模态框
   ========================================================== */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(20, 30, 55, .42);
    backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn .16s ease; }
.modal {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); animation: modalIn .22s cubic-bezier(.2,.8,.3,1);
}
.modal.modal-lg { max-width: 680px; }
.modal-head {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16.5px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; display: flex; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 24px; }
.modal-foot {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }

/* Toast 提示 */
#toast-box { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
    background: var(--text); color: #fff; box-shadow: var(--shadow-lg);
    animation: toastIn .24s cubic-bezier(.2,.8,.3,1); pointer-events: auto; max-width: 90vw;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-18px) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) } }

/* ==========================================================
   后台布局
   ========================================================== */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 200;
    transition: transform var(--transition);
}
.sidebar-brand {
    height: var(--header-h); display: flex; align-items: center; gap: 10px;
    padding: 0 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sidebar-brand img { width: 32px; height: 32px; object-fit: contain; border-radius: 8px; }
.sidebar-brand .txt { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.sidebar-brand .txt small { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: .6px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-nav .group-label {
    font-size: 11px; font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .8px; padding: 14px 10px 7px;
}
.sidebar-nav .group-label:first-child { padding-top: 4px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9.5px 12px; border-radius: 9px; margin-bottom: 2px;
    color: var(--text-2); font-size: 13.8px; font-weight: 500;
    transition: all var(--transition);
}
.sidebar-nav a .ico { color: var(--text-3); transition: color var(--transition); }
.sidebar-nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar-nav a:hover .ico { color: var(--text-2); }
.sidebar-nav a.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.sidebar-nav a.active .ico { color: var(--brand); }
.sidebar-nav a .nbadge {
    margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 7px;
    border-radius: 10px; background: var(--danger); color: #fff;
}

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--header-h); flex-shrink: 0;
    background: rgba(255,255,255,.9); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; padding: 0 22px;
    position: sticky; top: 0; z-index: 90;
}
.topbar .menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-2); padding: 6px; border-radius: 8px; }
.topbar .menu-toggle:hover { background: var(--surface-2); }
.topbar h2 { font-size: 16.5px; margin: 0; flex: 1; }
.topbar .tb-search { position: relative; width: 220px; }
.topbar .tb-actions { display: flex; align-items: center; gap: 8px; }

.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #4f8cff);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-menu { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
    border-radius: 30px; border: 1px solid transparent; background: none;
    cursor: pointer; font-family: inherit; transition: all var(--transition);
}
.user-menu-btn:hover { background: var(--surface-2); border-color: var(--border); }
.user-menu-btn .uname { font-size: 13.5px; font-weight: 500; color: var(--text); }
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 6px; display: none; animation: modalIn .16s ease;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px;
    border-radius: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 500;
}
.user-dropdown a:hover { background: var(--surface-2); color: var(--text); }
.user-dropdown a.danger { color: var(--danger); }
.user-dropdown a.danger:hover { background: var(--danger-bg); }
.user-dropdown .divider { height: 1px; background: var(--border); margin: 5px 0; }
.user-dropdown .dd-head { padding: 10px 12px 8px; }
.user-dropdown .dd-head .n { font-weight: 600; font-size: 14px; }
.user-dropdown .dd-head .e { font-size: 12px; color: var(--text-3); }

.content { padding: 24px 22px 44px; flex: 1; }
.content-head { margin-bottom: 22px; }

/* ==========================================================
   空状态
   ========================================================== */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .ico { width: 46px; height: 46px; color: #ccd5e3; margin-bottom: 12px; }
.empty h3 { font-size: 15px; color: var(--text-2); margin-bottom: 6px; }
.empty p { font-size: 13px; margin-bottom: 18px; }

/* ==========================================================
   登录 / 注册页
   ========================================================== */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 30px 20px; position: relative; overflow: hidden;
    background: linear-gradient(170deg, #f3f7ff 0%, #f9fbff 42%, #f6f8fc 100%);
}
.auth-bg-deco { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none; }
.auth-bg-deco.d1 { width: 420px; height: 420px; background: rgba(23,99,245,.16); top: -140px; right: -100px; }
.auth-bg-deco.d2 { width: 360px; height: 360px; background: rgba(79,140,255,.14); bottom: -120px; left: -90px; }
.auth-bg-deco.d3 { width: 260px; height: 260px; background: rgba(0,196,255,.1); top: 40%; left: 12%; }

.auth-card {
    position: relative; z-index: 2; width: 100%; max-width: 420px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,.9);
    border-radius: 20px; box-shadow: var(--shadow-lg); padding: 38px 34px;
}
.auth-card .auth-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-card .auth-logo img { width: 62px; height: 62px; object-fit: contain; }
.auth-card .auth-logo h1 { font-size: 21px; margin: 0; letter-spacing: -.3px; }
.auth-card .auth-logo p { font-size: 13px; color: var(--text-3); margin: 0; }
.auth-card .auth-foot { margin-top: 22px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.auth-card .auth-foot a { font-weight: 500; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ==========================================================
   提示结果页
   ========================================================== */
.msg-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.msg-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 44px 40px; max-width: 460px; text-align: center;
}
.msg-card .msg-icon { width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.msg-card .msg-icon .ico { width: 30px; height: 30px; }
.msg-card h2 { font-size: 19px; margin-bottom: 10px; }
.msg-card p { color: var(--text-2); font-size: 14px; margin-bottom: 24px; }
.msg-info .msg-icon { background: var(--info-bg); color: var(--info); }
.msg-success .msg-icon { background: var(--success-bg); color: var(--success); }
.msg-error .msg-icon { background: var(--danger-bg); color: var(--danger); }
.msg-warning .msg-icon { background: var(--warning-bg); color: var(--warning); }

/* ==========================================================
   首页 Hero
   ========================================================== */
.hero {
    position: relative; overflow: hidden; padding: 66px 0 60px;
    background: linear-gradient(168deg, #f4f8ff 0%, #fbfcff 55%, #f6f8fc 100%);
    border-bottom: 1px solid var(--border);
}
.hero-deco { position: absolute; border-radius: 50%; filter: blur(64px); pointer-events: none; }
.hero-deco.a { width: 380px; height: 380px; background: rgba(23,99,245,.14); top: -130px; right: -60px; }
.hero-deco.b { width: 300px; height: 300px; background: rgba(0,196,255,.1); bottom: -110px; left: -70px; }
.hero-inner { position: relative; z-index: 2; display: grid; grid-template-columns: 1.05fr .95fr; gap: 46px; align-items: center; }
.hero-tag {
    display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px;
    background: var(--brand-light); color: var(--brand); border-radius: 20px;
    font-size: 12.5px; font-weight: 600; margin-bottom: 18px;
}
.hero h1 { font-size: 38px; line-height: 1.22; letter-spacing: -.8px; margin-bottom: 16px; }
.hero h1 .hl { color: var(--brand); }
.hero .lead { font-size: 15.5px; color: var(--text-2); line-height: 1.75; margin-bottom: 26px; max-width: 520px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.hero-stat .v { font-size: 23px; font-weight: 700; letter-spacing: -.5px; }
.hero-stat .l { font-size: 12.5px; color: var(--text-3); }

.hero-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden;
}
.hero-panel .hp-bar {
    height: 38px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 7px; padding: 0 14px;
}
.hero-panel .hp-bar i { width: 10px; height: 10px; border-radius: 50%; background: #e0e5ee; }
.hero-panel .hp-bar i:nth-child(1) { background: #ff5f57; }
.hero-panel .hp-bar i:nth-child(2) { background: #febc2e; }
.hero-panel .hp-bar i:nth-child(3) { background: #28c840; }
.hero-panel .hp-bar span { margin-left: 8px; font-size: 12px; color: var(--text-3); font-family: "SF Mono", Consolas, monospace; }
.code-block {
    margin: 0; padding: 18px; font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: 12.5px; line-height: 1.85; color: #2c3b57; background: #fbfcfe; overflow-x: auto;
    white-space: pre;
}
.code-block .c-key { color: #1763f5; }
.code-block .c-str { color: #0d8a5f; }
.code-block .c-com { color: #9aa5b8; }
.code-block .c-fn  { color: #a350d0; }

/* 特性卡片 */
.feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px 22px; height: 100%;
    transition: all var(--transition);
}
.feature:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); border-color: var(--border-strong); }
.feature .f-icon {
    width: 44px; height: 44px; border-radius: 12px; background: var(--brand-light);
    color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 15px;
}
.feature h3 { font-size: 15.5px; margin-bottom: 8px; }
.feature p { font-size: 13.5px; color: var(--text-2); margin: 0; line-height: 1.7; }

/* 套餐卡 */
.plan {
    position: relative; background: var(--surface); border: 1.5px solid var(--border);
    border-radius: var(--radius-lg); padding: 26px 24px; display: flex; flex-direction: column;
    transition: all var(--transition);
}
.plan:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-3px); }
.plan.featured { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.plan .plan-flag {
    position: absolute; top: -11px; right: 20px; padding: 3px 12px;
    background: var(--brand); color: #fff; border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.plan .plan-name { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
.plan .plan-desc { font-size: 12.5px; color: var(--text-3); min-height: 20px; margin-bottom: 16px; }
.plan .plan-price { display: flex; align-items: baseline; gap: 8px; margin-bottom: 20px; }
.plan .plan-price .cur { font-size: 17px; font-weight: 600; color: var(--brand); }
.plan .plan-price .num { font-size: 34px; font-weight: 700; letter-spacing: -1px; color: var(--brand); line-height: 1; }
.plan .plan-price .orig { font-size: 13px; color: var(--text-3); text-decoration: line-through; }
.plan .plan-feats { list-style: none; margin: 0 0 22px; padding: 0; flex: 1; }
.plan .plan-feats li { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: var(--text-2); padding: 6.5px 0; }
.plan .plan-feats li .ico { color: var(--success); margin-top: 3px; flex-shrink: 0; }

.section-head { text-align: center; max-width: 620px; margin: 0 auto 34px; }
.section-head .eyebrow { font-size: 12.5px; font-weight: 600; color: var(--brand); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.section-head h2 { font-size: 27px; letter-spacing: -.5px; margin-bottom: 10px; }
.section-head p { color: var(--text-2); font-size: 14.5px; margin: 0; }

/* ==========================================================
   页脚
   ========================================================== */
.site-footer {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 34px 0 26px; margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 34px; margin-bottom: 26px; }
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { font-size: 13px; color: var(--text-3); line-height: 1.7; margin: 0; max-width: 300px; }
.footer-col h4 { font-size: 13.5px; margin-bottom: 12px; }
.footer-col a { display: block; font-size: 13px; color: var(--text-2); padding: 4.5px 0; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom {
    border-top: 1px solid var(--border); padding-top: 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    font-size: 12.5px; color: var(--text-3);
}

/* ==========================================================
   杂项
   ========================================================== */
.kv-list { display: flex; flex-direction: column; gap: 0; }
.kv-item { display: flex; padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv-item:last-child { border-bottom: none; }
.kv-item .k { width: 130px; flex-shrink: 0; color: var(--text-3); }
.kv-item .v { flex: 1; color: var(--text); word-break: break-all; }

.copy-cell { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.copy-cell .val { font-family: "SF Mono", Consolas, monospace; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-cell button { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 3px; border-radius: 5px; display: flex; }
.copy-cell button:hover { color: var(--brand); background: var(--brand-light); }

.license-key {
    display: inline-block; font-family: "SF Mono", Consolas, monospace;
    font-size: 12.5px; letter-spacing: -.2px; color: var(--text);
    background: var(--surface-2); border: 1px solid var(--border);
    padding: 3px 9px; border-radius: 6px; word-break: break-all;
}

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding: 10px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-chart .bar {
    width: 100%; max-width: 38px; background: linear-gradient(180deg, var(--brand), #4f8cff);
    border-radius: 6px 6px 3px 3px; min-height: 4px; transition: all var(--transition);
    position: relative;
}
.bar-chart .bar:hover { filter: brightness(1.08); }
.bar-chart .bar-label { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.progress { height: 7px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress .bar-inner { height: 100%; background: linear-gradient(90deg, var(--brand), #4f8cff); border-radius: 10px; transition: width .4s ease; }

.skeleton { background: linear-gradient(90deg, #eef1f6 25%, #f6f8fc 50%, #eef1f6 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }

/* ---------- Loading Spinner ---------- */
.spinner {
    display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
    border: 2px solid currentColor; border-top-color: transparent;
    border-radius: 50%; animation: spin .7s linear infinite; margin-right: 7px; opacity: .85;
}
.spinner-lg { width: 34px; height: 34px; border-width: 3px; color: var(--brand); margin: 0; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- 页面切换过渡 ---------- */
.fade-up { animation: fadeUp .32s cubic-bezier(.2,.8,.3,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* ---------- 代码内联 ---------- */
code {
    font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: .92em; background: var(--surface-2); color: #c0392b;
    padding: 1.5px 6px; border-radius: 5px; border: 1px solid var(--border);
}
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

.divider { height: 1px; background: var(--border); margin: 20px 0; border: none; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; margin: 20px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ==========================================================
   响应式
   ========================================================== */
@media (max-width: 1024px) {
    .hero-inner { grid-template-columns: 1fr; gap: 34px; }
    .hero h1 { font-size: 31px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

@media (max-width: 820px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: flex; }
    .nav-main { display: none; }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .topbar .tb-search { display: none; }
    .sidebar-backdrop {
        position: fixed; inset: 0; background: rgba(20,30,55,.4); z-index: 190; display: none;
    }
    .sidebar-backdrop.show { display: block; }
}

@media (max-width: 560px) {
    .container { padding: 0 16px; }
    .content { padding: 18px 16px 40px; }
    .hero { padding: 42px 0 40px; }
    .hero h1 { font-size: 26px; }
    .hero-stats { gap: 22px; }
    .grid-4 { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 22px; }
    .stat-value { font-size: 21px; }
    .card-body { padding: 16px; }
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .table th, .table td { padding: 10px 11px; }
    .modal-body { padding: 18px; }
}

/* ===== 法律/协议正文排版 ===== */
.legal-body { font-size: 14.5px; line-height: 1.9; color: var(--text-2); }
.legal-body h3 {
    font-size: 15.5px; font-weight: 600; color: var(--text-1);
    margin: 22px 0 10px; padding-left: 11px; position: relative; line-height: 1.5;
}
.legal-body h3:first-child { margin-top: 0; }
.legal-body h3::before {
    content: ''; position: absolute; left: 0; top: 3px; bottom: 3px;
    width: 3px; border-radius: 2px; background: var(--brand);
}
.legal-body p { margin: 0 0 10px; }
.legal-body strong { color: var(--text-1); font-weight: 600; }
.legal-body a { color: var(--brand); text-decoration: none; }
.legal-body a:hover { text-decoration: underline; }

/* ===== 文档门户布局 ===== */
.docs-layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
.docs-side { position: sticky; top: 84px; padding: 16px 14px; }
.docs-side-title { font-size: 13px; font-weight: 600; color: var(--text-1); display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.docs-nav { display: flex; flex-direction: column; gap: 2px; }
.docs-nav a {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
    font-size: 13.5px; color: var(--text-2); text-decoration: none; transition: all .15s;
}
.docs-nav a:hover { background: var(--bg-2); color: var(--brand); }
.docs-nav a.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.docs-nav a svg { flex: 0 0 auto; }
.docs-side-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.docs-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.docs-sec { scroll-margin-top: 84px; }
.docs-sec .card-head h2 { font-size: 17px; display: flex; align-items: center; gap: 9px; }
.docs-p { font-size: 14px; color: var(--text-2); line-height: 1.8; margin: 0 0 14px; }
.docs-h3 { font-size: 14.5px; font-weight: 600; color: var(--text-1); margin: 20px 0 10px; }
.docs-h3:first-child { margin-top: 0; }
.docs-ol { font-size: 14px; color: var(--text-2); line-height: 2; padding-left: 20px; margin: 0 0 14px; }
.docs-ol code, .docs-p code, .callout code, .faq code { background: var(--bg-2); padding: 1.5px 6px; border-radius: 5px; font-size: 12.5px; color: var(--brand); font-family: ui-monospace, Menlo, Consolas, monospace; }
.code-block {
    background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 16px 18px;
    font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.8px; line-height: 1.75;
    overflow-x: auto; margin: 0 0 14px; border: 1px solid #1e293b;
}
.code-block code { background: none; color: inherit; padding: 0; font-size: inherit; }
.steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.step-item { display: flex; gap: 13px; align-items: flex-start; }
.step-num {
    flex: 0 0 auto; width: 27px; height: 27px; border-radius: 50%; background: var(--brand);
    color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.step-item strong { font-size: 14px; color: var(--text-1); }
.step-item p { font-size: 13.3px; color: var(--text-2); line-height: 1.7; margin: 3px 0 0; }
.step-item a { color: var(--brand); text-decoration: none; }
.callout {
    display: flex; gap: 11px; padding: 13px 16px; border-radius: 10px; margin: 0 0 14px;
    font-size: 13.3px; line-height: 1.75; align-items: flex-start;
}
.callout svg { flex: 0 0 auto; margin-top: 2px; }
.callout-info { background: var(--brand-light); color: #1a4fb4; }
.callout-warn { background: #fff8ec; color: #92600a; border: 1px solid #fbe3b8; }
.sdk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.sdk-card {
    border: 1px solid var(--border); border-radius: 12px; padding: 18px 16px; text-align: center;
    display: flex; flex-direction: column; transition: all .18s;
}
.sdk-card:hover { border-color: var(--brand); box-shadow: 0 6px 20px rgba(23,99,245,.1); transform: translateY(-2px); }
.sdk-lang { margin-bottom: 8px; }
.sdk-name { font-size: 14.5px; font-weight: 600; color: var(--text-1); margin-bottom: 7px; }
.sdk-desc { font-size: 12.6px; color: var(--text-2); line-height: 1.65; flex: 1; margin-bottom: 10px; }
.sdk-files { font-size: 11.5px; color: var(--text-3, #94a3b8); font-family: ui-monospace, monospace; margin-bottom: 13px; word-break: break-all; }
.tabs-static { display: flex; gap: 6px; margin-bottom: 0; }
.tabs-static span {
    font-size: 12.5px; padding: 6px 14px; border-radius: 8px 8px 0 0; background: var(--bg-2);
    color: var(--text-2); border: 1px solid var(--border); border-bottom: none;
}
.tabs-static span.active { background: #0f172a; color: #e2e8f0; border-color: #0f172a; }
.tabs-static + .code-block { border-radius: 0 10px 10px 10px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.faq summary {
    padding: 13px 16px; font-size: 13.8px; font-weight: 600; color: var(--text-1); cursor: pointer;
    list-style: none; position: relative; padding-right: 40px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    font-size: 19px; font-weight: 400; color: var(--text-3, #94a3b8); transition: transform .2s;
}
.faq[open] summary::after { content: '−'; }
.faq summary:hover { background: var(--bg-2); }
.faq p { margin: 0; padding: 0 16px 15px; font-size: 13.4px; color: var(--text-2); line-height: 1.85; }
.faq p a { color: var(--brand); text-decoration: none; }
.faq p a:hover { text-decoration: underline; }
.badge-danger { background: #fef2f2; color: #dc2626; }

@media (max-width: 900px) {
    .docs-layout { grid-template-columns: 1fr; }
    .docs-side { position: static; }
    .docs-nav { flex-direction: row; flex-wrap: wrap; }
    .sdk-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   变量别名 & 兼容
   ========================================================== */
:root {
    --text-1: var(--text);
    --bg-2:   var(--surface-2);
    --brand-2: #4f8bff;
}

/* ==========================================================
   动效体系
   ========================================================== */
@keyframes czxFadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes czxFadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes czxScaleIn  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes czxFloat    { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes czxSpin     { to { transform: rotate(360deg); } }
@keyframes czxShake    { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
@keyframes czxPulse    { 0% { box-shadow: 0 0 0 0 var(--brand-glow); } 70% { box-shadow: 0 0 0 12px rgba(23,99,245,0); } 100% { box-shadow: 0 0 0 0 rgba(23,99,245,0); } }
@keyframes czxRipple   { to { transform: scale(2.6); opacity: 0; } }
@keyframes czxFall     { to { transform: translateY(112vh) rotate(540deg); opacity: .9; } }
@keyframes czxDash     { to { stroke-dashoffset: 0; } }
@keyframes czxBar      { from { width: 0; } to { width: 100%; } }
@keyframes czxShimmer  { 100% { transform: translateX(100%); } }

.fade-up { animation: czxFadeUp .5s cubic-bezier(.22,.8,.3,1) both; }
.fade-in { animation: czxFadeIn .5s ease both; }
.scale-in { animation: czxScaleIn .28s cubic-bezier(.22,.9,.3,1) both; }

/* 滚动入场 */
[data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity .6s cubic-bezier(.22,.8,.3,1), transform .6s cubic-bezier(.22,.8,.3,1); }
[data-reveal].revealed { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: .08s; }
[data-reveal][data-delay="2"] { transition-delay: .16s; }
[data-reveal][data-delay="3"] { transition-delay: .24s; }
[data-reveal][data-delay="4"] { transition-delay: .32s; }

/* 按钮涟漪 + 微交互 */
.btn { position: relative; overflow: hidden; }
.btn::after {
    content: ''; position: absolute; left: var(--rx, 50%); top: var(--ry, 50%);
    width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.55);
    transform: scale(0); opacity: 0; pointer-events: none;
}
.btn.rippling::after { animation: czxRipple .6s ease-out; }
.btn:active { transform: translateY(1px) scale(.99); }
.card { transition: box-shadow .22s var(--transition), transform .22s var(--transition), border-color .22s var(--transition); }
.card:hover { box-shadow: var(--shadow-sm); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #eef2f8 25%, #f6f8fc 37%, #eef2f8 63%);
    background-size: 400% 100%; border-radius: 6px; position: relative; overflow: hidden;
    animation: czxSpin 0s;
}
.skeleton::after {
    content: ''; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
    animation: czxShimmer 1.3s infinite;
}

/* ==========================================================
   前台导航 - 移动端
   ========================================================== */
.nav-toggle {
    display: none; width: 38px; height: 38px; border: 1px solid var(--border);
    background: var(--surface); border-radius: 10px; cursor: pointer; align-items: center;
    justify-content: center; color: var(--text-2); padding: 0;
}
.nav-toggle:hover { border-color: var(--brand); color: var(--brand); }
.nav-drawer {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg); padding: 10px 16px 18px; z-index: 120;
}
.nav-drawer.open { display: block; animation: czxFadeUp .26s ease both; }
.nav-drawer a {
    display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 10px;
    color: var(--text-2); text-decoration: none; font-size: 15px; transition: var(--transition);
}
.nav-drawer a:hover, .nav-drawer a.active { background: var(--brand-light); color: var(--brand); }
.nav-drawer .drawer-actions { display: flex; gap: 10px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.nav-drawer .drawer-actions .btn { flex: 1; justify-content: center; }
.site-header { position: relative; }

/* ==========================================================
   后台/控制台 移动端增强
   ========================================================== */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.table { min-width: 640px; }

.filter-bar { margin-bottom: 16px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filter-item { display: flex; flex-direction: column; gap: 6px; min-width: 160px; flex: 1 1 160px; }
.filter-item label { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin: 0; }
.filter-item .form-control { height: 38px; }
.filter-submit { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 8px; }

.tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { white-space: nowrap; flex: 0 0 auto; }

.td-actions { display: flex; align-items: center; gap: 2px; }
.btn-icon.danger { color: var(--danger); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }

.table-empty {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    padding: 42px 20px; color: var(--text-3);
}
.table-empty p { margin: 0; font-size: 13.5px; }

.empty-state {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: 52px 24px; gap: 8px;
}
.empty-state .empty-icon {
    width: 66px; height: 66px; border-radius: 50%; background: var(--brand-light);
    color: var(--brand); display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.empty-state h3 { margin: 0; font-size: 16px; color: var(--text-1); }
.empty-state p { margin: 0 0 14px; font-size: 13.5px; color: var(--text-2); max-width: 380px; line-height: 1.7; }

.divider-line {
    display: flex; align-items: center; gap: 12px; margin: 22px 0 16px;
    font-size: 12.5px; color: var(--text-3); font-weight: 600;
}
.divider-line::before, .divider-line::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-mini {
    display: flex; align-items: center; gap: 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
    transition: var(--transition);
}
.stat-mini:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.stat-mini .ic { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.stat-mini .ic.warn { background: var(--warning-bg); color: var(--warning); }
.stat-mini .ic.danger { background: var(--danger-bg); color: var(--danger); }
.stat-mini .ic.brand { background: var(--brand-light); color: var(--brand); }
.stat-mini b { display: block; font-size: 19px; color: var(--text-1); line-height: 1.25; }
.stat-mini span { font-size: 12.5px; color: var(--text-3); }

.row-warn { background: #fffdf7; }
.badge-brand { background: var(--brand-light); color: var(--brand); }

/* 应用卡片 */
.app-card .card-head h3 { display: flex; align-items: center; gap: 7px; }
.app-key-box {
    display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 9px;
    background: var(--surface-2); border: 1px dashed var(--border-strong);
    font-size: 12.4px; cursor: pointer; transition: var(--transition); margin-bottom: 8px;
}
.app-key-box:hover { border-color: var(--brand); background: var(--brand-light); }
.app-key-box .lab { font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: .5px; flex: 0 0 auto; }
.app-key-box .mono { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.app-key-box svg { flex: 0 0 auto; color: var(--text-3); }

/* ==========================================================
   注册向导
   ========================================================== */
.reg-page { background: linear-gradient(168deg, #f4f8ff 0%, #f6f8fc 42%, #eef3fd 100%); }
.reg-wrap { padding: 34px 18px; align-items: flex-start; }
.reg-shell {
    position: relative; z-index: 2; width: 100%; max-width: 480px; margin: 0 auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow-lg); padding: 30px 30px 22px;
}
.reg-brand { text-align: center; margin-bottom: 22px; }
.reg-brand img { width: 52px; height: 52px; object-fit: contain; border-radius: 13px; margin-bottom: 12px; }
.reg-brand h1 { font-size: 21px; margin: 0 0 6px; color: var(--text-1); }
.reg-brand p { margin: 0; font-size: 13.2px; color: var(--text-3); }

.reg-progress { display: flex; align-items: center; margin: 0 6px 26px; }
.reg-progress .dot { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; }
.reg-progress .dot span {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--surface-2); border: 2px solid var(--border-strong); color: var(--text-3);
    font-size: 13px; font-weight: 700; transition: all .32s cubic-bezier(.34,1.4,.5,1);
}
.reg-progress .dot em { font-style: normal; font-size: 11.5px; color: var(--text-3); transition: var(--transition); }
.reg-progress .dot.current span { background: var(--brand); border-color: var(--brand); color: #fff; transform: scale(1.12); box-shadow: 0 6px 16px var(--brand-glow); }
.reg-progress .dot.current em { color: var(--brand); font-weight: 600; }
.reg-progress .dot.done span { background: var(--success); border-color: var(--success); color: #fff; }
.reg-progress .dot.done em { color: var(--success); }
.reg-progress .line { flex: 1; height: 2px; background: var(--border); margin: 0 8px 22px; position: relative; overflow: hidden; border-radius: 2px; }
.reg-progress .line.done { background: var(--success); }

.reg-scroll { min-height: 300px; position: relative; }
.reg-step { display: none; animation: czxFadeUp .42s cubic-bezier(.22,.8,.3,1) both; }
.reg-step.active { display: block; }
/* 单页平铺模式：后台关闭「分步注册」时，步骤 1/2 同时可见，隐藏进度条与「上一步」；
   步骤 3（完成页）仍只在提交成功后由 JS 显示 */
.reg-shell.single .reg-progress { display: none; }
.reg-shell.single .reg-step { display: block; margin-bottom: 26px; }
.reg-shell.single .reg-step[data-step="3"]:not(.active) { display: none; }
.reg-shell.single #backBtn { display: none; }
.step-title { font-size: 17px; margin: 0 0 5px; color: var(--text-1); }
.step-sub { font-size: 13px; color: var(--text-3); margin: 0 0 20px; }

.ch-tabs { display: flex; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.ch-tab {
    flex: 1; border: none; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer;
    font-size: 13.5px; color: var(--text-2); font-family: inherit; display: flex; align-items: center;
    justify-content: center; gap: 6px; transition: var(--transition);
}
.ch-tab.active { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--shadow-xs); }

/* OTP 验证码输入 */
.otp-wrap { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .45s cubic-bezier(.22,.8,.3,1), opacity .35s; }
.otp-wrap.show { max-height: 190px; opacity: 1; }
.otp { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 10px; }
.otp-cell {
    flex: 1; min-width: 0; height: 52px; text-align: center; font-size: 22px; font-weight: 700;
    color: var(--text-1); border: 1.6px solid var(--border-strong); border-radius: 11px;
    background: var(--surface); outline: none; transition: all .18s var(--transition);
    font-family: ui-monospace, Menlo, Consolas, monospace; padding: 0;
}
.otp-cell:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.otp-cell.filled { border-color: var(--brand); background: #fbfdff; }
.otp-cell.error { border-color: var(--danger); animation: czxShake .42s; }

.otp-state { font-size: 12.8px; min-height: 20px; display: flex; align-items: center; gap: 7px; }
.otp-state.loading { color: var(--text-3); }
.otp-state.ok { color: var(--success); font-weight: 600; }
.otp-state.error { color: var(--danger); }
.spinner {
    width: 13px; height: 13px; border: 2px solid var(--border-strong); border-top-color: var(--brand);
    border-radius: 50%; display: inline-block; animation: czxSpin .7s linear infinite;
}

/* 勾选成功动画 */
.check-svg { width: 20px; height: 20px; }
.check-svg.big { width: 74px; height: 74px; }
.check-svg .check-circle { stroke: var(--success); stroke-width: 3.4; stroke-dasharray: 160; stroke-dashoffset: 160; animation: czxDash .5s ease-out forwards; }
.check-svg .check-path { stroke: var(--success); stroke-width: 4.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: czxDash .34s .42s ease-out forwards; }

.success-flash {
    position: absolute; inset: 0; border-radius: 20px; pointer-events: none; z-index: 5;
    background: radial-gradient(circle at 50% 40%, rgba(23,166,115,.20), transparent 62%);
    animation: czxFadeIn .16s ease-out reverse;
}

/* 获取验证码按钮 */
.btn-code {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; cursor: pointer;
    border: 1px solid var(--brand); color: var(--brand); background: var(--brand-light);
    border-radius: 8px; font-size: 12.8px; font-family: inherit; font-weight: 500;
    transition: var(--transition); white-space: nowrap;
}
.btn-code:hover:not(:disabled) { background: var(--brand); color: #fff; }
.btn-code:disabled { opacity: .6; cursor: not-allowed; border-color: var(--border-strong); background: var(--surface-2); color: var(--text-3); }

/* 小人动画 */
.mascot { display: flex; flex-direction: column; align-items: center; margin: -4px 0 16px; }
.mascot-svg { width: 128px; height: 116px; }
.mascot .hand { transition: transform .44s cubic-bezier(.34,1.5,.5,1); }
.mascot .hand-l { transform-origin: 46px 56px; }
.mascot .hand-r { transform-origin: 84px 56px; }
.mascot .eyes .eye { transform-origin: center; transition: transform .3s var(--transition); }
.mascot.peek .hand-l { transform: translate(-13px, 15px) rotate(-22deg); }
.mascot.peek .hand-r { transform: translate(13px, 15px) rotate(22deg); }
.mascot.peek .eyes .eye { transform: scale(1.22); }
.mascot.peek .mouth { d: path("M56 68 q9 10 18 0"); }
.mascot .mascot-tip { font-size: 12.4px; color: var(--text-3); margin-top: 6px; transition: var(--transition); }
.mascot.peek .mascot-tip { color: var(--brand); }

.verified-badge {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 30px;
    background: var(--success-bg); color: var(--success); font-size: 12.8px; margin-bottom: 18px; font-weight: 500;
}
.verified-badge em { font-style: normal; font-size: 11.5px; opacity: .8; }
.verified-badge span { font-weight: 600; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 密码强度 */
.pwd-meter { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pwd-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--border); position: relative; overflow: hidden; }
.pwd-bar::after { content: ''; position: absolute; inset: 0; width: 0; border-radius: 3px; transition: width .3s var(--transition), background .3s; }
.pwd-bar.lv1::after { width: 25%; background: #ef4444; }
.pwd-bar.lv2::after { width: 50%; background: #f59e0b; }
.pwd-bar.lv3::after { width: 75%; background: #3b82f6; }
.pwd-bar.lv4::after { width: 100%; background: #17a673; }
.pwd-txt { font-size: 12px; color: var(--text-3); min-width: 66px; text-align: right; }

/* 完成页 */
.reg-done { text-align: center; padding: 18px 0 8px; }
.done-ring {
    width: 96px; height: 96px; margin: 0 auto 20px; border-radius: 50%;
    background: var(--success-bg); display: flex; align-items: center; justify-content: center;
    animation: czxPulse 1.8s ease-out 1;
}
.reg-done h2 { margin: 0 0 8px; font-size: 21px; color: var(--text-1); }
.reg-done p { margin: 0 0 18px; font-size: 13.5px; color: var(--text-2); }
.done-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin: 0 auto 20px; max-width: 240px; }
.done-bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; animation: czxBar 1.7s linear forwards; }

/* 彩带 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.confetti i {
    position: absolute; top: -14px; width: 8px; height: 14px; border-radius: 2px;
    animation-name: czxFall; animation-timing-function: cubic-bezier(.3,.6,.6,1); animation-fill-mode: forwards;
}

/* ==========================================================
   验证码组件
   ========================================================== */
.captcha-slot { min-height: 44px; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-input { flex: 1 1 auto; min-width: 0; }
.captcha-input .form-control { height: 46px; letter-spacing: 2px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.captcha-img-box {
    flex: 0 0 auto; width: 132px; border: 1px solid var(--border); border-radius: 10px;
    overflow: hidden; cursor: pointer; background: var(--surface-2); display: flex;
    align-items: center; justify-content: center; transition: var(--transition);
}
.captcha-img-box:hover { border-color: var(--brand); }
.captcha-img { width: 100%; height: 46px; object-fit: cover; display: block; }
.geetest-box { min-height: 44px; }

/* 注册页背景装饰 */
.auth-float {
    position: absolute; border-radius: 50%; filter: blur(28px); opacity: .5; z-index: 1;
    background: radial-gradient(circle, rgba(23,99,245,.4), transparent 70%);
    animation: czxFloat 7s ease-in-out infinite;
}
.auth-float.f1 { width: 190px; height: 190px; left: 8%; top: 14%; }
.auth-float.f2 { width: 150px; height: 150px; right: 10%; bottom: 12%; animation-delay: 1.6s; }

/* ==========================================================
   响应式增强
   ========================================================== */
@media (max-width: 1024px) {
    .stat-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
    .nav-main { display: none !important; }
    .nav-toggle { display: inline-flex; }
    .site-header .nav-actions .btn span.txt-opt { display: none; }
    .stat-strip { grid-template-columns: 1fr; }
    .docs-layout { grid-template-columns: 1fr; }
    .grid-auto { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
    .site-header .container { gap: 10px; }
    .brand span .brand-sub { display: none; }
    .brand span { font-size: 15px; }
    .brand img { width: 32px; height: 32px; }
    .nav-actions .btn { padding: 8px 11px; }
    .page-head h1 { font-size: 19px !important; }
    .filter-item { flex: 1 1 100%; min-width: 0; }
    .filter-submit { flex: 1 1 100%; }
    .filter-submit .btn { flex: 1; justify-content: center; }
    .table { min-width: 560px; }
    .modal { width: calc(100vw - 24px) !important; max-height: 90vh; border-radius: 16px; }
    .modal.modal-lg { width: calc(100vw - 24px) !important; }
    .modal-body { padding: 16px; }
    .modal-foot { padding: 12px 16px; }
    .pager { flex-direction: column; align-items: center; gap: 10px; }
    .btn-row { flex-wrap: wrap; }
    .stat-strip { grid-template-columns: 1fr; }
    .docs-nav { overflow-x: auto; flex-wrap: nowrap; }
    .docs-nav a { flex: 0 0 auto; }
    .sdk-grid { grid-template-columns: 1fr !important; }
    .topbar h2 { font-size: 15px; }
    .user-menu .uname { display: none; }
    .reg-shell { padding: 24px 20px 18px; border-radius: 16px; }
    .reg-brand h1 { font-size: 19px; }
    .otp { gap: 6px; }
    .otp-cell { height: 46px; font-size: 19px; border-radius: 9px; }
    .captcha-img-box { width: 112px; }
    .card-body { padding: 15px; }
    .content { padding: 16px 14px 40px; }
    .page-head { gap: 10px; }
    .page-head .btn { padding: 9px 14px; }
}

@media (max-width: 400px) {
    .reg-progress .dot em { display: none; }
    .otp-cell { height: 42px; font-size: 17px; }
    .captcha-row { flex-direction: column; }
    .captcha-img-box { width: 100%; }
}

/* 应用分组标题 */
.app-group-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 16px; }
.app-group-head .ag-icon {
    width: 34px; height: 34px; border-radius: 10px; background: var(--brand-light); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 17px; flex: 0 0 auto;
}
.app-group-head h2 { margin: 0; font-size: 16px; color: var(--text-1); }
.app-group-head .ag-count { font-size: 12.5px; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 20px; }
