@charset "UTF-8";
/* ============================================================
   授权管理系统 · 设计系统（自写纯 CSS，无框架依赖）
   布局：桌面端左侧固定侧栏 + 内容区；移动端抽屉式侧栏
   风格：简洁浅色（白卡片 + 浅灰底 + 品牌蓝）
   ============================================================ */

/* ---------- 1. 设计变量 ---------- */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --border-strong: #d1d5db;

    --text: #111827;
    --text-soft: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;

    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-ring: rgba(37, 99, 235, .18);

    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --purple: #7c3aed;
    --purple-soft: #ede9fe;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-full: 999px;

    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow: 0 4px 12px -2px rgba(16, 24, 40, .09), 0 2px 6px -2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 16px 32px -12px rgba(16, 24, 40, .18);

    --sidebar-w: 256px;
    --topbar-h: 60px;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---------- 2. 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    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;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-strong); }

button, input, select, textarea { font: inherit; color: inherit; }

table { border-collapse: collapse; width: 100%; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8dce2; border-radius: var(--radius-full); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c8d0; background-clip: content-box; }

/* ---------- 3. 应用外壳 ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.app__col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- 4. 侧边栏 ---------- */
.sidebar {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
}

.sidebar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    letter-spacing: -.01em;
    min-width: 0;
}
.brand:hover { color: var(--text); }
.brand__mark {
    width: 32px; height: 32px;
    flex-shrink: 0;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 6px var(--primary-ring);
}
.brand__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar__close {
    display: none;
    background: none;
    border: 0;
    padding: 4px;
    color: var(--text-faint);
    cursor: pointer;
    border-radius: var(--radius-sm);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.sidebar__close:hover { background: var(--surface-2); color: var(--text); }

/* 侧栏用户信息 */
.sidebar__user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.avatar {
    width: 38px; height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #60a5fa, var(--primary));
    color: #fff;
    font-size: 14px;
}
.sidebar__user-meta { min-width: 0; }
.sidebar__user-name {
    font-weight: 600;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar__user-role { margin-top: 3px; }

/* 侧栏导航 */
.sidebar__nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 500;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; color: var(--text-faint); transition: color .15s var(--ease); flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover i { color: var(--text-muted); }

.nav-item.is-active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.nav-item.is-active i { color: var(--primary); }

.nav-item--danger:hover { background: #fef2f2; color: var(--danger); }
.nav-item--danger:hover i { color: var(--danger); }

.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }

.nav-label {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* 遮罩 */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s var(--ease), visibility .25s var(--ease);
    z-index: 55;
    /* 刻意不用 backdrop-filter：全屏模糊 + 同时动画 transform 会让低端安卓机
       在抽屉打开的一瞬间卡住甚至不重绘，看起来就像"点了没反应"。 */
}

/* ---------- 5. 顶栏 ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar__toggle {
    display: none;
    background: none;
    border: 0;
    padding: 7px 9px;
    margin-left: -6px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.topbar__toggle:hover { background: var(--surface-2); color: var(--text); }

.topbar__title {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 6px; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    padding-right: 4px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px; height: 34px;
    border: 0;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-soft); }
.icon-btn--danger:hover { background: #fef2f2; color: var(--danger); }

/* ---------- 6. 主内容区 ---------- */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.main__inner { flex: 1; padding: 22px 0 40px; }

.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 860px; }
.container--slim { max-width: 560px; }

/* 页头（替代原深色 Hero） */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}
.page-header h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.3;
}
.page-header p { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* 页脚 */
.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 18px 0;
    text-align: center;
    font-size: 12.5px;
    color: var(--text-faint);
}

/* ---------- 7. 卡片 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card + .card, .card + .stat-grid, .stat-grid + .card { margin-top: 16px; }

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card__head h2 { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card__head h2 i { color: var(--text-faint); font-size: 13px; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

/* 悬浮卡片 */
.card--hover { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.card--hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

/* ---------- 8. 统计卡片 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}
.stat-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-xs);
    color: inherit;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); color: inherit; }

.stat--row { display: flex; align-items: center; gap: 12px; }
.stat__icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 15px;
}
.stat__icon--blue   { background: var(--primary-soft); color: var(--primary); }
.stat__icon--green  { background: var(--success-soft); color: var(--success); }
.stat__icon--red    { background: var(--danger-soft);  color: var(--danger); }
.stat__icon--yellow { background: var(--warning-soft); color: var(--warning); }
.stat__icon--purple { background: var(--purple-soft);  color: var(--purple); }
.stat__icon--gray   { background: #f3f4f6; color: var(--text-muted); }

.stat__label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stat__value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; line-height: 1.25; }
.stat__sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.stat__top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.stat__top .stat__icon { width: 32px; height: 32px; font-size: 13px; }

/* ---------- 9. 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 550;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-soft);
    transition: background .15s var(--ease), color .15s var(--ease),
                border-color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
    user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px var(--primary-ring); }
.btn--primary:hover { background: var(--primary-strong); color: #fff; }

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

.btn--ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-2); border-color: #b8bec7; color: var(--text); }

.btn--soft { background: var(--surface-2); color: var(--text-soft); border-color: var(--border); }
.btn--soft:hover { background: #eef0f3; color: var(--text); }

.btn--danger-soft { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn--danger-soft:hover { background: var(--danger-soft); color: #b91c1c; }

.btn--warning-soft { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.btn--warning-soft:hover { background: var(--warning-soft); color: #92400e; }

.btn--purple { background: var(--purple); color: #fff; }
.btn--purple:hover { background: #6d28d9; color: #fff; }

.btn--green { background: var(--success); color: #fff; }
.btn--green:hover { background: #15803d; color: #fff; }

.btn--sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn--lg { padding: 11px 22px; font-size: 14.5px; }
.btn--block { width: 100%; }
.btn--icon { padding: 7px 9px; }

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

/* ---------- 10. 徽章 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.7;
    white-space: nowrap;
}
.badge--green  { background: var(--success-soft); color: #15803d; }
.badge--yellow { background: var(--warning-soft); color: #b45309; }
.badge--red    { background: var(--danger-soft);  color: #b91c1c; }
.badge--blue   { background: var(--primary-soft); color: var(--primary-strong); }
.badge--purple { background: var(--purple-soft);  color: #6d28d9; }
.badge--gray   { background: #f3f4f6; color: #4b5563; }
.badge--orange { background: #ffedd5; color: #c2410c; }

/* ---------- 11. 表格 ---------- */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table { font-size: 13px; min-width: 560px; }
.table thead th {
    text-align: left;
    padding: 10px 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f3f5;
    color: var(--text-soft);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s var(--ease); }
.table tbody tr:hover { background: #fafbfc; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-muted); }
.table .muted { color: var(--text-faint); font-size: 12px; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table--fixed { min-width: 0; table-layout: fixed; }

.table-foot {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--text-muted);
}

/* 表格内联小按钮 */
.t-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }

/* ---------- 12. 移动端列表卡片 ---------- */
.mobile-list { display: flex; flex-direction: column; }
.mobile-item {
    padding: 13px 18px;
    border-bottom: 1px solid #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.mobile-item:last-child { border-bottom: 0; }
.mobile-item__main { min-width: 0; flex: 1; }
.mobile-item__title { font-weight: 600; font-size: 13.5px; color: var(--text); word-break: break-all; }
.mobile-item__title.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; font-weight: 500; }
.mobile-item__meta { margin-top: 3px; font-size: 12px; color: var(--text-faint); }
.mobile-item__side { flex-shrink: 0; text-align: right; }

/* ---------- 13. 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group > label, .form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
}
.form-label .req { color: var(--danger); }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13.5px;
    color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
    outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.textarea { min-height: 96px; resize: vertical; }
.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8.5 1.5 4h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* 带图标的输入框 */
.input-icon { position: relative; }
.input-icon > i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 13px;
    pointer-events: none;
}
.input-icon > .input, .input-icon > .select { padding-left: 38px; }

.form-hint { font-size: 12px; color: var(--text-faint); }
.form-error { font-size: 12px; color: var(--danger); }

/* 行内表单 / 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.filter-bar .form-group { gap: 4px; min-width: 130px; }
.filter-bar .form-group > label { font-size: 12px; color: var(--text-muted); }

/* 复选 / 单选 */
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* 开关 */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background .2s var(--ease);
}
.toggle__slider::before {
    content: "";
    position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--shadow-xs);
    transition: transform .2s var(--ease);
}
.toggle input:checked + .toggle__slider { background: var(--success); }
.toggle input:checked + .toggle__slider::before { transform: translateX(18px); }
.toggle input:focus-visible + .toggle__slider { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------- 14. 提示条 ---------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border: 1px solid;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.55;
}
.alert i { margin-top: 2px; flex-shrink: 0; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: 650; }
.alert a { font-weight: 600; text-decoration: underline; }

.alert--success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert--error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert--warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.alert--info    { background: var(--primary-soft); border-color: #bfdbfe; color: var(--primary-strong); }

.alert-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

/* ---------- 15. 空状态 ---------- */
.empty {
    padding: 54px 20px;
    text-align: center;
}
.empty__icon {
    width: 48px; height: 48px;
    margin: 0 auto 12px;
    border-radius: var(--radius);
    background: #f3f4f6;
    display: grid;
    place-items: center;
    color: #cbd5e1;
    font-size: 19px;
}
.empty__text { color: var(--text-faint); font-size: 13.5px; }

/* ---------- 16. 模态框 ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.is-open { display: flex; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .55);
    animation: fadeIn .2s var(--ease);
}
.modal__card {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalIn .22s var(--ease);
}
.modal__card--wide { max-width: 680px; }
.modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal__head h3 { font-size: 15px; font-weight: 650; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

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

/* ---------- 17. Toast ---------- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid;
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 13px;
    pointer-events: auto;
}
.toast > i { margin-top: 2px; flex-shrink: 0; font-size: 14px; }
.toast__msg { flex: 1; min-width: 0; color: var(--text-soft); }
.toast__close {
    background: none; border: 0; padding: 0 2px;
    color: var(--text-faint); cursor: pointer; flex-shrink: 0; font-size: 12px;
}
.toast__close:hover { color: var(--text-soft); }

.toast--success { border-color: #bbf7d0; border-left-color: var(--success); }
.toast--success > i { color: var(--success); }
.toast--error { border-color: #fecaca; border-left-color: var(--danger); }
.toast--error > i { color: var(--danger); }
.toast--warning { border-color: #fde68a; border-left-color: var(--warning); }
.toast--warning > i { color: var(--warning); }
.toast--info { border-color: #bfdbfe; border-left-color: var(--primary); }
.toast--info > i { color: var(--primary); }

.toast-enter { animation: toastIn .35s var(--ease); }
.toast-exit { animation: toastOut .25s var(--ease) forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateX(110%); }
}

/* ---------- 18. 认证页（登录 / 注册 / 支付结果） ---------- */
.auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 18px;
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(37, 99, 235, .10), transparent 60%),
        radial-gradient(800px 460px at 92% 108%, rgba(79, 70, 229, .10), transparent 60%),
        var(--bg);
}
.auth__box { width: 100%; max-width: 404px; }
.auth__head { text-align: center; margin-bottom: 24px; }
.auth__mark {
    width: 58px; height: 58px;
    margin: 0 auto 16px;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    font-size: 23px;
    box-shadow: 0 8px 20px -6px var(--primary-ring);
}
.auth__head h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.auth__head p { margin-top: 5px; color: var(--text-muted); font-size: 13.5px; }
.auth__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 26px;
}
.auth__foot { margin-top: 18px; text-align: center; font-size: 13px; }
.auth__foot a { font-weight: 550; }

/* ---------- 19. 定价卡（购买授权） ---------- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    align-items: stretch;
}
.pricing-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.pricing-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.pricing-card--featured { border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(124, 58, 237, .10), var(--shadow-sm); }

.pricing-card__ribbon {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 10px -2px rgba(124, 58, 237, .45);
    white-space: nowrap;
    z-index: 2;
}
.pricing-card__ribbon--alt { background: linear-gradient(135deg, #6366f1, #4f46e5); box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .45); }

.pricing-card__head { padding: 26px 22px 16px; text-align: center; }
.pricing-card__icon {
    width: 52px; height: 52px;
    margin: 0 auto 14px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    font-size: 20px;
    transition: transform .25s var(--ease);
}
.pricing-card:hover .pricing-card__icon { transform: scale(1.08); }
.pricing-card__name { font-size: 16px; font-weight: 700; }
.pricing-card__desc { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }

.pricing-card__price { padding: 0 22px 6px; text-align: center; }
.price { display: flex; align-items: baseline; justify-content: center; gap: 2px; }
.price__cur { font-size: 14px; font-weight: 600; color: var(--text-faint); }
.price__num { font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--text); line-height: 1.15; }
.price__was { margin-top: 2px; font-size: 13px; color: var(--text-faint); text-decoration: line-through; }
.price__per { margin-top: 3px; font-size: 11.5px; color: var(--text-faint); }
.price__agent {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--purple-soft);
    color: #6d28d9;
    font-size: 12px;
    font-weight: 600;
    transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.price__agent i { font-size: 10.5px; }
.price__agent strong { font-weight: 700; }
.price__agent:hover { color: #6d28d9; transform: translateY(-1px); box-shadow: 0 2px 6px rgba(124, 58, 237, .18); }
.price__agent-go {
    margin-left: 2px;
    padding-left: 8px;
    border-left: 1px solid rgba(124, 58, 237, .25);
    font-weight: 500;
    color: var(--purple);
}

.pricing-card__features { flex: 1; padding: 16px 22px; }
.pricing-card__features li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--text-soft);
    padding: 5px 0;
}
.pricing-card__features li i { color: var(--success); font-size: 12px; margin-top: 4px; flex-shrink: 0; }
.pricing-card__foot { padding: 0 22px 24px; }

/* ---------- 20. 杂项组件 ---------- */
/* 键值列表 */
.kv { display: flex; flex-direction: column; gap: 12px; }
.kv__row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 13.5px; }
.kv__key { color: var(--text-muted); flex-shrink: 0; }
.kv__val { font-weight: 600; text-align: right; min-width: 0; word-break: break-all; }

/* 授权码 / 等宽展示块 */
.code-block {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-soft);
    word-break: break-all;
    user-select: all;
}
.code-block--sm { font-size: 11.5px; padding: 5px 9px; }

/* 标签 chips 列表 */
.list-inline { display: flex; flex-wrap: wrap; gap: 6px; }

/* 分段标题 */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 650;
    margin-bottom: 12px;
}
.section-title i { color: var(--text-faint); font-size: 13px; }

/* 网格工具 */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* 下载平台卡 */
.platform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.platform-card { text-align: center; padding: 24px 18px; }
.platform-card__icon {
    width: 52px; height: 52px;
    margin: 0 auto 12px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    font-size: 21px;
}
.platform-card h3 { font-size: 15px; font-weight: 650; }
.platform-card p { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }

/* 文本工具 */
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.fw-600 { font-weight: 600; }
.mono-text { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-full { width: 100%; }

/* 分页 */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 16px;
}
.pagination a, .pagination span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-soft);
    background: var(--surface);
}
.pagination a:hover { background: var(--surface-2); border-color: var(--border-strong); }
.pagination .is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pagination .is-disabled { opacity: .45; pointer-events: none; }

/* 分隔线 */
.hr { height: 1px; background: var(--border); border: 0; margin: 16px 0; }

/* 骨架/加载遮罩 */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 20b. 补充组件（阶段 2） ---------- */

/* 定价卡图标配色 */
.pricing-card__icon--blue   { background: var(--primary-soft); color: var(--primary); }
.pricing-card__icon--purple { background: var(--purple-soft);  color: var(--purple); }
.pricing-card__icon--green  { background: var(--success-soft); color: var(--success); }
.pricing-card__icon--yellow { background: var(--warning-soft); color: var(--warning); }

/* 数量步进器 */
.qty {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px 4px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.qty__label { font-size: 12.5px; color: var(--text-muted); margin-right: auto; }
.qty__btn {
    width: 28px; height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.qty__btn:hover { color: var(--text); border-color: var(--border-strong); }
.qty__input {
    width: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    font-size: 13.5px;
    font-weight: 650;
    color: var(--text);
    outline: none;
}

/* 分段筛选器 */
.seg {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.seg > a {
    padding: 6px 13px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text-muted);
    white-space: nowrap;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.seg > a:hover { color: var(--text); background: var(--surface); }
.seg > a.is-active { background: var(--surface); color: var(--primary-strong); font-weight: 650; box-shadow: var(--shadow-xs); }

/* 卡片纵向布局（页脚按钮贴底） */
.card--flex { display: flex; flex-direction: column; }
.card--flex > .card__body { flex: 1; }
.card__foot { padding: 0 18px 18px; }
.card__head--tinted { background: var(--surface-2); }

/* 可折叠移动项 */
.mobile-item--fold { display: block; padding: 0; }
.mobile-item__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 15px;
    cursor: pointer;
    list-style: none;
}
.mobile-item__summary::-webkit-details-marker { display: none; }
.mobile-item__summary > i { color: var(--text-faint); font-size: 11px; transition: transform .2s var(--ease); flex-shrink: 0; }
.mobile-item--fold[open] .mobile-item__summary > i { transform: rotate(180deg); }
.mobile-item__detail { padding: 12px 15px 14px; border-top: 1px solid var(--border); }
.mobile-item__detail .kv__row + .kv__row { margin-top: 8px; }

/* 特性清单（勾选） */
.feature-list { display: flex; flex-direction: column; gap: 9px; }
.feature-list > li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--text-soft); }
.feature-list > li > i { color: var(--success); font-size: 13px; margin-top: 3px; flex-shrink: 0; }
.feature-list strong { color: var(--text); font-weight: 650; }

/* 底部信任条 */
.trust-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 26px;
    margin-top: 26px;
    font-size: 12.5px;
    color: var(--text-faint);
}
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }

/* 代码内联标记 */
.code-inline {
    padding: 1px 6px;
    border-radius: 5px;
    background: #f3f4f6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .92em;
    color: var(--text-soft);
}

/* 主次分栏（桌面侧栏式，移动端主内容优先） */
.grid-2--split { grid-template-columns: 1.65fr 1fr; align-items: start; }
@media (max-width: 767px) {
    .grid-2--split { grid-template-columns: 1fr; }
    .grid-2--split > .is-priority { order: -1; }
}

/* 列表底栏（计数 + 分页） */
.list-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 10px 16px;
}
.list-foot__info { font-size: 12.5px; color: var(--text-muted); }
.list-foot--top { border-top: 1px solid var(--border); }
.list-foot .pagination { padding: 0; }

/* ---------- 20c. 编辑行 / 设置行（阶段 3） ---------- */

/* 价格编辑行（桌面表格式，移动端堆叠） */
.prow {
    display: grid;
    grid-template-columns: minmax(140px, 1.3fr) minmax(110px, 1fr) minmax(110px, 1fr) 92px;
    gap: 8px 16px;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
}
.prow:last-child { border-bottom: 0; }
.prow--head {
    padding-top: 11px;
    padding-bottom: 11px;
    background: var(--surface-2);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
}
.prow__name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.prow__title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
               font-size: 13.5px; font-weight: 650; color: var(--text); }
.prow__key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
             font-size: 11.5px; color: var(--text-faint); }
.prow__cell { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.prow__cell > .form-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.prow__switch { display: flex; align-items: center; gap: 9px; }
.prow__switch-label { font-size: 12px; color: var(--text-muted); }

/* 设置项：左说明 + 右开关 */
.switch-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.switch-row__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch-row__title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.switch-row__desc { font-size: 12px; color: var(--text-muted); }

/* ---------- 21. 动画 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}
.fade-in { animation: fadeIn .3s var(--ease); }
.fade-up { animation: fadeInUp .4s var(--ease) both; }
.delay-1 { animation-delay: .04s; }
.delay-2 { animation-delay: .08s; }
.delay-3 { animation-delay: .12s; }
.delay-4 { animation-delay: .16s; }

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

/* ---------- 22. 显示工具 ---------- */
@media (min-width: 768px)  { .hide-desktop { display: none !important; } }
@media (max-width: 767px)  { .hide-mobile  { display: none !important; } }

/* ---------- 23. 响应式：平板 / 移动 ---------- */
@media (max-width: 1023px) {
    .app { grid-template-columns: 1fr; }

    /* 移动端顶栏不做毛玻璃：省掉滚动时每帧重算的 blur，低端机明显更跟手 */
    .topbar {
        background: #fff;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: min(280px, 86vw);
        height: 100%;
        height: 100dvh;                 /* iOS Safari 的 100vh 会含地址栏，底部导航会被切掉 */
        padding-bottom: env(safe-area-inset-bottom);
        transform: translate3d(-100%, 0, 0);   /* 3D 变换强制走 GPU 合成，滑动不闪 */
        transition: transform .28s var(--ease);
        box-shadow: var(--shadow-lg);
        z-index: 60;
        will-change: transform;
    }
    /* 双保险：JS 在 <aside> 和 <body> 上都打标记，任一命中即可滑出 */
    .sidebar.is-open,
    body.nav-open .sidebar { transform: translate3d(0, 0, 0); }

    .sidebar__close { display: inline-grid; place-items: center; }
    .sidebar-backdrop.is-open,
    body.nav-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    /* 抽屉与弹窗各自锁滚动：弹窗走 modal-open，免得顺手把离屏侧栏也滑出来 */
    body.nav-open,
    body.modal-open { overflow: hidden; }

    .topbar__toggle { display: inline-grid; place-items: center; }
}

@media (max-width: 767px) {
    .main__inner { padding: 16px 0 32px; }
    .container { padding: 0 14px; }

    .page-header { align-items: flex-start; margin-bottom: 16px; }
    .page-header h1 { font-size: 18.5px; }
    .page-header__actions { width: 100%; }
    .page-header__actions .btn { flex: 1; }

    .stat-grid, .stat-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px; }
    .stat__value { font-size: 18.5px; }
    .stat__top { gap: 8px; margin-bottom: 8px; }
    .stat__top .stat__icon { width: 28px; height: 28px; font-size: 12px; }

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

    .card__head { padding: 13px 15px; }
    .card__body { padding: 15px; }
    .table thead th { padding: 9px 15px; }
    .table tbody td { padding: 11px 15px; }
    .mobile-item { padding: 12px 15px; }
    .filter-bar { padding: 14px 15px; }
    .filter-bar .form-group { flex: 1 1 140px; }

    .prow { grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 15px; }
    .prow__name, .prow__switch { grid-column: 1 / -1; }

    .auth__card { padding: 20px; }
    .auth__head { margin-bottom: 18px; }
    .pricing-grid { grid-template-columns: 1fr; gap: 14px; }
    .pricing-card--featured { transform: none; }

    .modal { padding: 12px; align-items: flex-end; }
    .modal__card { max-width: 100%; max-height: calc(100vh - 24px); }
    .modal__card--wide { max-width: 100%; }
    .modal__head, .modal__body { padding-left: 16px; padding-right: 16px; }
    .modal__foot { padding: 12px 16px; }
    .modal__foot .btn { flex: 1; }

    .toast-container { top: 12px; right: 12px; left: 12px; width: auto; }
}

@media (max-width: 399px) {
    .stat-grid, .stat-grid--3 { grid-template-columns: 1fr; }
}

/* ---------- 24. 下载页小喇叭公告 ---------- */
.horn {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 15px;
    margin: 0 0 16px;
    background: linear-gradient(90deg, #fff7ed 0%, #fffbeb 60%, #fefce8 100%);
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    color: #b45309;
    font-size: 13px;
    line-height: 1.62;
    box-shadow: var(--shadow-xs);
}
.horn__icon {
    flex-shrink: 0;
    width: 26px; height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-full);
    background: #fde68a;
    font-size: 12.5px;
    /* 喇叭偶尔晃一下，间隔拉长，避免干扰阅读 */
    animation: hornRing 3.2s var(--ease) infinite;
}
.horn__body { flex: 1; min-width: 0; word-break: break-word; }
.horn__body > :first-child { margin-top: 0; }
.horn__body > :last-child { margin-bottom: 0; }
.horn__body p { margin: 0 0 6px; }
.horn__body strong, .horn__body b { font-weight: 700; }
.horn__body a { color: inherit; font-weight: 650; text-decoration: underline; }
.horn__body a:hover { color: #92400e; }
.horn__body img { max-width: 100%; height: auto; vertical-align: middle; border-radius: 6px; }
.horn__body code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(180, 83, 9, .1);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

@keyframes hornRing {
    0%, 68%, 100% { transform: rotate(0deg); }
    74% { transform: rotate(-14deg); }
    80% { transform: rotate(11deg); }
    86% { transform: rotate(-6deg); }
    92% { transform: rotate(2deg); }
}

@media (max-width: 767px) {
    .horn { gap: 9px; padding: 11px 12px; font-size: 12.5px; }
    .horn__icon { width: 24px; height: 24px; font-size: 11.5px; }
}
