/* ═══════════════════════════════════════════════
   CasePy Design System v2.0
   统一布局、视觉风格和排版规范
   ═══════════════════════════════════════════════ */

/* ===== Design Tokens ===== */
:root {
    /* ── Primary Palette ── */
    --cp-primary: #1e3a5f;
    --cp-primary-hover: #2a5080;
    --cp-primary-light: #3a649e;
    --cp-primary-dark: #152a45;
    --cp-primary-bg: #e8eef7;
    --cp-primary-bg-hover: #d4dff0;

    /* ── Accent / Gold ── */
    --cp-accent: #e8a838;
    --cp-accent-hover: #f0c060;
    --cp-accent-dark: #c58a1f;
    --cp-accent-bg: #fef7e7;
    --cp-accent-bg-hover: #fdf0ce;

    /* ── Surfaces ── */
    --cp-surface: #ffffff;
    --cp-surface-alt: #f9fafb;
    --cp-bg: #f2f5f9;
    --cp-bg-hover: #e8ecf2;

    /* ── Text ── */
    --cp-text: #1a2236;
    --cp-text-secondary: #59667a;
    --cp-text-muted: #8c95a6;
    --cp-text-placeholder: #aeb7c4;

    /* ── Semantic ── */
    --cp-success: #16a34a;
    --cp-success-bg: #ecfdf5;
    --cp-warning: #d97706;
    --cp-warning-bg: #fffbeb;
    --cp-danger: #dc2626;
    --cp-danger-bg: #fef2f2;
    --cp-info: #2563eb;
    --cp-info-bg: #eff6ff;
    --cp-archived: #64748b;
    --cp-archived-bg: #f8fafc;

    /* ── Borders ── */
    --cp-border: #dbe1e9;
    --cp-border-light: #e8ecf2;
    --cp-border-focus: #1e3a5f;

    /* ── Shadows ── */
    --cp-shadow-xs: 0 1px 2px rgba(26,34,54,0.04);
    --cp-shadow-sm: 0 1px 3px rgba(26,34,54,0.06);
    --cp-shadow: 0 2px 12px rgba(26,34,54,0.07);
    --cp-shadow-md: 0 4px 20px rgba(26,34,54,0.09);
    --cp-shadow-lg: 0 8px 32px rgba(26,34,54,0.11);

    /* ── Radii ── */
    --cp-radius-sm: 8px;
    --cp-radius: 12px;
    --cp-radius-lg: 16px;
    --cp-radius-xl: 20px;
    --cp-radius-full: 100px;

    /* ── Transitions ── */
    --cp-t-fast: 0.15s cubic-bezier(0.4,0,0.2,1);
    --cp-t-base: 0.25s cubic-bezier(0.4,0,0.2,1);
    --cp-t-slow: 0.35s cubic-bezier(0.4,0,0.2,1);

    /* ── Typography ── */
    --cp-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
    --cp-font-mono: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

/* ═══════════════════════════════════════════════
   Midnight Theme — 登录页深蓝金配色
   应用于导航栏 & 页面头部背景
   ═══════════════════════════════════════════════ */
[data-theme="midnight"] {
    --cp-nav-accent: #d4af6c;
    --cp-nav-bg-start: #080f1a;
    --cp-nav-bg-mid: #0f2236;
    --cp-nav-bg-end: #122a44;
    /* ── design-system 全局变量 ── */
    --cp-bg: #0c1622;
    --cp-surface: #111d2e;
    --cp-surface-alt: #152336;
    --cp-text: #e2e8f0;
    --cp-text-secondary: #94a3b8;
    --cp-text-muted: #64748b;
    --cp-border: #1e3148;
    --cp-border-light: #16273a;
    --cp-primary: #5b8fce;
    --cp-primary-hover: #7aa8dc;
    --cp-primary-bg: #15273d;
    --cp-primary-bg-hover: #1a2e46;
    --cp-accent-bg: #1f1a0a;
    --cp-accent-bg-hover: #2a240e;
    --cp-success-bg: #0a2e1a;
    --cp-warning-bg: #2d1f06;
    --cp-danger-bg: #2e0a0a;
    --cp-info-bg: #0f1f3a;
    --cp-archived-bg: #111d2e;
    /* ── style.css 原生变量覆写（卡片/表格/表单） ── */
    --bg: #0c1622;
    --bg-card: #111d2e;
    --bg-hover: #1a2d42;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e3148;
    --border-light: #16273a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.25);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.35);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.4);
    /* ── 语义色：浅化适配深色背景 ── */
    --primary: #5b8fce;
    --primary-dark: #1e3a5f;
    --primary-light: #15273d;
    --primary-50: #0f1d30;
    --primary-100: #14253a;
    --primary-700: #5b8fce;
    --accent: #60a5fa;
    --accent-dark: #3b82f6;
    --accent-light: #1a2744;
    --success-light: #0a2e1a;
    --warning-light: #2d1f06;
    --danger-light: #2e0a0a;
    color-scheme: dark;
}
/* ── 导航栏：登录页同款极深渐变（midnight & sierra 共享） ── */
[data-theme="midnight"] .cp-nav,
[data-theme="sierra"]  .cp-nav {
    background: linear-gradient(135deg,
        rgba(8,15,26,0.88) 0%,
        rgba(15,34,54,0.9) 50%,
        rgba(18,42,68,0.92) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(212,175,108,0.06);
    box-shadow: 0 2px 24px rgba(5,8,16,0.3);
}
[data-theme="midnight"] .cp-nav--scrolled,
[data-theme="sierra"]  .cp-nav--scrolled {
    background: linear-gradient(165deg, #080f1a 0%, #0f2236 35%, #0c1a2d 65%, #122a44 100%);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom-color: rgba(212,175,108,0.15);
    box-shadow: 0 4px 28px rgba(5,8,16,0.45);
}
/* ── 底部发光边框改用登录页金色 ── */
[data-theme="midnight"] .cp-nav__glow,
[data-theme="sierra"]  .cp-nav__glow {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212,175,108,0.12) 20%,
        rgba(212,175,108,0.3) 50%,
        rgba(212,175,108,0.12) 80%,
        transparent 100%);
}
/* ── 页面头部：登录页深色渐变 ── */
[data-theme="midnight"] .cp-page-header,
[data-theme="sierra"]  .cp-page-header {
    background: linear-gradient(165deg, #080f1a 0%, #0f2236 35%, #0c1a2d 65%, #122a44 100%);
}
[data-theme="midnight"] .cp-page-header::before,
[data-theme="sierra"]  .cp-page-header::before {
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
}
[data-theme="midnight"] .cp-page-header::after,
[data-theme="sierra"]  .cp-page-header::after {
    background: radial-gradient(circle, rgba(212,175,108,0.1) 0%, transparent 70%);
}
/* ── 深色头部区域选中文字：白色高亮 ── */
[data-theme="midnight"] .cp-page-header ::selection,
[data-theme="sierra"]  .cp-page-header ::selection {
    color: #fff;
    background: rgba(212, 175, 108, 0.35);
}
[data-theme="midnight"] .cp-page-header ::-moz-selection,
[data-theme="sierra"]  .cp-page-header ::-moz-selection {
    color: #fff;
    background: rgba(212, 175, 108, 0.35);
}
/* ── 统计标签微调 ── */
[data-theme="midnight"] .cp-stat-tag,
[data-theme="sierra"]  .cp-stat-tag {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.12);
}
/* ── 导航用户头像 ── */
[data-theme="midnight"] .cp-nav__user-avatar,
[data-theme="sierra"]  .cp-nav__user-avatar {
    background: linear-gradient(135deg, #d4af6c, #b8943d);
}
[data-theme="midnight"] .cp-nav__logo i,
[data-theme="sierra"]  .cp-nav__logo i,
[data-theme="midnight"] .cp-header-title h1 i,
[data-theme="sierra"]  .cp-header-title h1 i {
    color: #d4af6c;
}
/* ── 激活态链接 ── */
[data-theme="midnight"] .nav-links > li > a.active,
[data-theme="sierra"]  .nav-links > li > a.active {
    color: #d4af6c;
}

/* ═══════════════════════════════════════════════
   Sierra Theme — 登录页藏蓝金，轻量品牌主题
   仅改导航/头部 & 强调色，body 保持浅色
   ═══════════════════════════════════════════════ */
[data-theme="sierra"] {
    /* 强调色 — 明亮暖金，去掉褐色底调 */
    --cp-accent: #e2b950;
    --cp-accent-hover: #f0d478;
    --cp-accent-dark: #c09020;
    --cp-accent-bg: #fdf8f0;
    --cp-accent-bg-hover: #fbf0dd;
    --cp-nav-accent: #e2b950;
    --accent: #e2b950;
    --accent-dark: #c09020;
    --accent-light: #fdf8f0;
}

/* ═══════════════════════════════════════════════
   主题切换按钮 — 融入导航栏，低调行内图标
   ═══════════════════════════════════════════════ */
.cp-nav__theme-item {
    display: flex; align-items: center;
}
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--cp-radius-sm);
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 0.92rem; cursor: pointer;
    transition: all var(--cp-t-fast);
    padding: 0;
    margin: 0 2px;
}
.theme-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: var(--cp-accent);
}
.theme-toggle:focus-visible {
    outline: 2px solid rgba(212,175,108,0.5);
    outline-offset: 1px;
}
/* 已激活午夜/品牌主题时的按钮状态 */
[data-theme="midnight"] .theme-toggle,
[data-theme="sierra"]  .theme-toggle {
    color: #d4af6c;
}
[data-theme="midnight"] .theme-toggle:hover,
[data-theme="sierra"]  .theme-toggle:hover {
    background: rgba(212,175,108,0.12);
    color: #e0c482;
}
/* 移动端侧边栏中保持可点 */
@media (max-width: 768px) {
    .cp-nav__theme-item {
        padding: 2px 0;
    }
    .theme-toggle {
        width: 36px; height: 36px;
        font-size: 1rem;
        margin: 0 0 0 -2px;
    }
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth;
    overflow-x: clip;
    overscroll-behavior-x: none;
}
body {
    font-family: var(--cp-font);
    font-size: 0.938rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--cp-text);
    background: var(--cp-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    width: 100%;
    overflow-x: clip;
}
a { color: var(--cp-primary); text-decoration: none; }
a:hover { color: var(--cp-primary-hover); }
img { max-width: 100%; height: auto; }

/* ===== Container ===== */
.cp-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Page Header ===== */
.cp-page-header {
    background: linear-gradient(135deg, var(--cp-primary) 0%, #1a3558 50%, var(--cp-primary-dark) 100%);
    padding: 38px 0;
    position: relative;
    overflow: hidden;
}

/* ===== Main Content Area ===== */
.cp-main {
    padding: 28px 0 60px;
    background: var(--cp-bg);
    min-height: 60vh;
}
.cp-page-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.cp-page-header::after {
    content: '';
    position: absolute;
    bottom: -30%; right: 5%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(232,168,56,0.12) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.cp-header-inner {
    position: relative; z-index: 1;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 20px;
}
.cp-header-title h1 {
    color: #fff; font-size: 1.75rem; font-weight: 700;
    margin: 0 0 10px 0;
    display: flex; align-items: center; gap: 12px;
    letter-spacing: -0.02em;
}
.cp-header-title h1 i { color: var(--cp-accent); font-size: 1.5rem; }
.cp-header-title p {
    color: rgba(255,255,255,0.75); font-size: 0.88rem; margin: 0;
}
/* Page header action buttons group (responsive row → column) */
.cp-header-actions {
    display: flex; gap: 12px; flex-wrap: wrap;
}
.cp-header-stats {
    display: flex; gap: 10px; flex-wrap: wrap;
}
.cp-stat-tag {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 5px 14px; border-radius: var(--cp-radius-full);
    font-size: 0.85rem;
    display: inline-flex; align-items: center; gap: 6px;
    transition: background var(--cp-t-fast), border-color var(--cp-t-fast);
}
.cp-stat-tag strong { color: var(--cp-accent); font-weight: 700; font-size: 1rem; }

/* ===== Buttons ===== */
.cp-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px; font-size: 0.9rem; font-weight: 600;
    border: 1.5px solid transparent; border-radius: var(--cp-radius-sm);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: all var(--cp-t-fast);
    font-family: inherit; line-height: 1.4;
}
.cp-btn:focus-visible { outline: 3px solid rgba(30,58,95,0.4); outline-offset: 2px; }
.cp-btn:active { transform: scale(0.97); }
.cp-btn--primary {
    background: var(--cp-primary); color: #fff; border-color: var(--cp-primary);
}
.cp-btn--primary:hover {
    background: var(--cp-primary-hover); border-color: var(--cp-primary-hover);
    box-shadow: 0 4px 12px rgba(30,58,95,0.25); transform: translateY(-1px);
    color: #fff;
}
.cp-btn--accent {
    background: var(--cp-accent); color: var(--cp-primary-dark); border-color: var(--cp-accent);
    box-shadow: 0 4px 16px rgba(232,168,56,0.35);
    border-radius: var(--cp-radius-full); padding: 12px 28px; font-weight: 700;
}
.cp-btn--accent:hover {
    background: var(--cp-accent-hover); transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(232,168,56,0.5);
    color: var(--cp-primary-dark);
}
.cp-btn--secondary {
    background: transparent; color: var(--cp-text-secondary); border-color: var(--cp-border);
}
.cp-btn--secondary:hover {
    color: var(--cp-text); border-color: var(--cp-text-muted);
    background: var(--cp-bg-hover); transform: translateY(-1px);
}
.cp-btn--header {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}
.cp-btn--header:hover {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transform: translateY(-1px);
    color: #fff;
}
.cp-btn--danger {
    background: var(--cp-danger); color: #fff; border-color: var(--cp-danger);
}
.cp-btn--danger:hover {
    background: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,0.25); transform: translateY(-1px);
    color: #fff;
}
.cp-btn--success {
    background: var(--cp-success); color: #fff; border-color: var(--cp-success);
}
.cp-btn--sm { padding: 7px 16px; font-size: 0.82rem; }
.cp-btn--lg { padding: 13px 28px; font-size: 0.95rem; }
.cp-btn--icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--cp-radius-sm); }

/* ===== Card ===== */
.cp-card {
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow);
    border: 1px solid var(--cp-border-light);
    margin-bottom: 24px;
}
.cp-card__header {
    padding: 18px 24px; border-bottom: 1px solid var(--cp-border-light);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.cp-card__title {
    font-size: 1rem; font-weight: 700; color: var(--cp-text);
    display: flex; align-items: center; gap: 8px; margin: 0;
}
.cp-card__title i { color: var(--cp-primary); }
.cp-card__body { padding: 24px; }

/* ===== Stat Card Icon Color Variants ===== */
.cp-stat-card__icon--primary { background: var(--cp-primary-bg); color: var(--cp-primary); }
.cp-stat-card__icon--warning { background: var(--cp-warning-bg); color: var(--cp-warning); }
.cp-stat-card__icon--success { background: var(--cp-success-bg); color: var(--cp-success); }
.cp-stat-card__icon--danger { background: var(--cp-danger-bg); color: var(--cp-danger); }
.cp-stat-card__icon--info { background: var(--cp-info-bg); color: var(--cp-info); }

/* ===== Table Sub Label (shown below main link in table cells) ===== */
.cp-table__sub-label {
    display: block; font-size: 0.75rem; color: var(--cp-text-muted);
    margin-top: 2px;
}

/* ===== Search Field -- Wide (spans 2 columns on desktop) ===== */
.cp-search-field--wide { grid-column: span 2; }

/* ===== Action Button Text Label (hidden on desktop, shown on mobile cards) ===== */
.cp-action-btn__label { display: none; }

/* ===== Search Card ===== */
.cp-search-card {
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow);
    border: 1px solid var(--cp-border-light);
    padding: 24px; margin-bottom: 24px;
}
.cp-search-card__label {
    font-size: 0.82rem; font-weight: 600; color: var(--cp-text-secondary);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin: 0 0 18px 0;
    display: flex; align-items: center; gap: 8px;
}
.cp-search-card__label i { color: var(--cp-primary); }
.cp-search-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px; align-items: end;
}
.cp-search-field { display: flex; flex-direction: column; gap: 5px; }
.cp-search-field label {
    font-size: 0.78rem; font-weight: 600; color: var(--cp-text-secondary);
    letter-spacing: 0.02em;
}
.cp-search-field input,
.cp-search-field select,
.cp-search-field textarea {
    width: 100%; padding: 10px 14px; font-size: 0.9rem;
    border: 1.5px solid var(--cp-border);
    border-radius: var(--cp-radius-sm);
    background: var(--cp-surface); color: var(--cp-text);
    transition: border-color var(--cp-t-fast), box-shadow var(--cp-t-fast);
    font-family: inherit; height: 42px; box-sizing: border-box;
}
.cp-search-field input::placeholder,
.cp-search-field textarea::placeholder { color: var(--cp-text-placeholder); }
.cp-search-field input:hover,
.cp-search-field select:hover,
.cp-search-field textarea:hover { border-color: var(--cp-primary-light); }
.cp-search-field input:focus,
.cp-search-field select:focus,
.cp-search-field textarea:focus {
    outline: none; border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.1);
}
.cp-search-actions {
    display: flex; gap: 10px; align-items: center; height: 42px;
}

/* ===== Data Table ===== */
.cp-table-wrap {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: var(--cp-border) transparent;
}
.cp-table-wrap::-webkit-scrollbar { height: 6px; }
.cp-table-wrap::-webkit-scrollbar-track { background: transparent; }
.cp-table-wrap::-webkit-scrollbar-thumb { background: var(--cp-border); border-radius: 10px; }

.cp-table {
    width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 800px;
}
.cp-table thead th {
    background: var(--cp-bg); color: var(--cp-text-secondary);
    font-weight: 700; font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 14px 16px; text-align: left;
    border-bottom: 2px solid var(--cp-border); white-space: nowrap; user-select: none;
}

/* ---- Sortable Table Header ---- */
.cp-sortable { cursor: default; }
.cp-sort-cell {
    display: inline-flex; align-items: center; gap: 6px;
}
.cp-sort-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 4px;
    color: var(--cp-text-muted); text-decoration: none;
    transition: color var(--cp-t-fast), background var(--cp-t-fast);
}
.cp-sort-link:hover {
    color: var(--cp-primary); background: rgba(30,58,95,0.06);
}
.cp-sort-link--active,
.cp-sort-link--active:hover {
    color: var(--cp-primary); background: rgba(30,58,95,0.08);
}
.cp-sort-link i { font-size: 0.85rem; }
.cp-table tbody tr {
    transition: background var(--cp-t-fast);
    border-bottom: 1px solid var(--cp-border-light);
}
.cp-table tbody tr:hover { background: rgba(30,58,95,0.025); }
.cp-table tbody tr:focus-within { background: rgba(30,58,95,0.04); outline: none; }
.cp-table tbody td { padding: 14px 16px; color: var(--cp-text); vertical-align: middle; }
.cp-table tbody td:first-child { font-weight: 600; }

/* ---- Compact Table ---- */
.cp-table--compact tbody td { padding: 10px 14px; font-size: 0.88rem; }
.cp-table--compact thead th { padding: 10px 14px; font-size: 0.78rem; }

/* ---- Table Footer (tfoot) ---- */
.cp-table tfoot td,
.cp-table tfoot th {
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cp-text);
    background: linear-gradient(to bottom, var(--cp-bg), color-mix(in srgb, var(--cp-bg) 95%, var(--cp-text-muted)));
    border-top: 2px solid var(--cp-border);
    vertical-align: middle;
}
.cp-table tfoot td:last-child { text-align: right; }
.cp-table tfoot .cp-total-label {
    text-align: right; color: var(--cp-text-secondary);
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.cp-table tfoot .cp-total-value {
    color: var(--cp-primary); font-variant-numeric: tabular-nums;
}
.cp-table tfoot .cp-total-count {
    display: inline-block;
    padding: 1px 10px; border-radius: var(--cp-radius-full);
    background: var(--cp-primary-bg); color: var(--cp-primary);
    font-size: 0.78rem; font-weight: 600; margin-left: 6px;
}

/* Sticky tfoot when table is scrollable */
.cp-table-wrap:has(tfoot) .cp-table tfoot td,
.cp-table-wrap:has(tfoot) .cp-table tfoot th {
    position: sticky; bottom: 0; z-index: 2;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.cp-table__link {
    color: var(--cp-primary); text-decoration: none; font-weight: 700;
    position: relative;
}
.cp-table__link::after {
    content: ''; position: absolute; bottom: -2px; left: 0;
    width: 0; height: 2px; background: var(--cp-primary);
    transition: width var(--cp-t-base);
}
.cp-table__link:hover { color: var(--cp-primary-hover); }
.cp-table__link:hover::after { width: 100%; }
.cp-table__link:focus-visible { outline: 2px solid var(--cp-primary); outline-offset: 2px; border-radius: 2px; }

/* ===== Status Tags ===== */
.cp-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 14px; border-radius: var(--cp-radius-full);
    font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
    transition: transform var(--cp-t-fast);
}
.cp-status:hover { transform: scale(1.04); }
.cp-status::before {
    content: ''; display: inline-block;
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.cp-status--active { background: var(--cp-success-bg); color: #065f46; }
.cp-status--active::before { background: var(--cp-success); box-shadow: 0 0 0 3px rgba(22,163,74,0.2); }
.cp-status--closed { background: var(--cp-info-bg); color: #1e40af; }
.cp-status--closed::before { background: var(--cp-info); box-shadow: 0 0 0 3px rgba(37,99,235,0.2); }
.cp-status--archived { background: var(--cp-archived-bg); color: #475569; }
.cp-status--archived::before { background: var(--cp-archived); box-shadow: 0 0 0 3px rgba(100,116,139,0.2); }
.cp-status--cancelled { background: var(--cp-danger-bg); color: #991b1b; }
.cp-status--cancelled::before { background: var(--cp-danger); box-shadow: 0 0 0 3px rgba(220,38,38,0.2); }
.cp-status--pending { background: var(--cp-warning-bg); color: #92400e; }
.cp-status--pending::before { background: var(--cp-warning); box-shadow: 0 0 0 3px rgba(217,119,6,0.2); }

/* ===== Badge ===== */
.cp-badge {
    display: inline-block; padding: 4px 12px; border-radius: var(--cp-radius-full);
    font-size: 0.8rem; font-weight: 600;
    background: var(--cp-bg-hover); color: var(--cp-text-secondary);
}
.cp-badge--type {
    background: #eef2ff; color: #4338ca;
    display: inline-flex; align-items: center; gap: 5px;
}

/* ===== Action Buttons (inline table) ===== */
.cp-action-cell { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.cp-action-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px; border-radius: var(--cp-radius-sm);
    font-size: 0.82rem; font-weight: 600; text-decoration: none;
    cursor: pointer; transition: all var(--cp-t-fast);
    border: 1.5px solid transparent;
}
.cp-action-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.cp-action-btn:active { transform: scale(0.96); }
.cp-action-btn--view {
    color: var(--cp-primary); background: rgba(30,58,95,0.06); border-color: rgba(30,58,95,0.12);
}
.cp-action-btn--view:hover {
    background: rgba(30,58,95,0.12); border-color: var(--cp-primary); transform: translateY(-1px);
    color: var(--cp-primary);
}
.cp-action-btn--edit {
    color: #92400e; background: rgba(232,168,56,0.10); border-color: rgba(232,168,56,0.2);
}
.cp-action-btn--edit:hover {
    background: rgba(232,168,56,0.18); border-color: var(--cp-accent); transform: translateY(-1px);
    color: #92400e;
}
.cp-action-btn--danger {
    color: var(--cp-danger); background: rgba(220,38,38,0.06); border-color: rgba(220,38,38,0.15);
}
.cp-action-btn--danger:hover {
    background: rgba(220,38,38,0.12); border-color: var(--cp-danger); transform: translateY(-1px);
    color: var(--cp-danger);
}
.cp-action-btn--muted {
    color: var(--cp-text-muted); background: transparent; border-color: transparent;
    cursor: default;
}

/* ===== Pagination ===== */
.cp-pagination {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px; padding: 20px 24px;
    border-top: 1px solid var(--cp-border-light);
}
.cp-pagination__links { display: flex; align-items: center; gap: 6px; }
.cp-pagination__btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 18px; border-radius: var(--cp-radius-sm);
    font-size: 0.88rem; font-weight: 600; text-decoration: none;
    color: var(--cp-text-secondary); border: 1.5px solid var(--cp-border);
    background: var(--cp-surface);
    transition: all var(--cp-t-fast);
}
.cp-pagination__btn:hover {
    color: var(--cp-primary); border-color: var(--cp-primary);
    background: rgba(30,58,95,0.04); transform: translateY(-1px);
}
.cp-pagination__btn:focus-visible { outline: 2px solid var(--cp-primary); outline-offset: 2px; }
.cp-pagination__btn:active { transform: scale(0.97); }
.cp-pagination__btn--disabled {
    opacity: 0.4; cursor: not-allowed; pointer-events: none;
}
.cp-pagination__info {
    padding: 8px 18px; font-size: 0.88rem; font-weight: 600;
    color: var(--cp-text); background: var(--cp-bg-hover);
    border-radius: var(--cp-radius-sm);
}

/* ===== Empty State ===== */
.cp-empty {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 48px 24px; text-align: center;
}
.cp-empty i { font-size: 3rem; color: var(--cp-border); opacity: 0.7; }
.cp-empty p { color: var(--cp-text-muted); font-size: 0.92rem; margin: 0; }
.cp-empty__link { color: var(--cp-primary); font-weight: 600; }

/* ===== Form Styles ===== */
.cp-form-section { margin-bottom: 32px; }
.cp-form-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.05rem; font-weight: 700; color: var(--cp-text);
    margin-bottom: 10px;
}
.cp-form-section-title i { color: var(--cp-primary); }
.cp-form-section-desc {
    color: var(--cp-text-muted); font-size: 0.85rem;
    margin: 0 0 20px 0;
}
.cp-form-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/*
 * ═══════════════════════════════════════════════
 *  FORM INPUT CORE
 *  统一输入框视觉规范 — 边框/圆角/阴影/背景/字体
 * ═══════════════════════════════════════════════
 */

/* ── Form Group container ── */
.cp-form-group {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 12px;
}

/* ── Label ── */
.cp-form-label {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 0.85rem; font-weight: 600; color: var(--cp-text);
    letter-spacing: 0.01em; user-select: none;
    line-height: 1.4;
}
.cp-form-label i,
.cp-form-label .fa,
.cp-form-label .fas,
.cp-form-label .fa-solid,
.cp-form-label .fa-regular {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
/* fallback: legacy label inside .cp-form-group */
.cp-form-group > label {
    font-size: 0.85rem; font-weight: 600; color: var(--cp-text);
    display: flex; align-items: center; gap: 4px;
}

/* ── Required marker ── */
.cp-form-required {
    color: var(--cp-danger); font-size: 0.85rem;
    line-height: 1; margin-left: 1px;
}

/*
 * ── Base Input Styles ──
 *   Applies to: .cp-form-input | .cp-form-select | .cp-form-textarea
 *   Also auto-catches Django-rendered {{ form.field }} inside .cp-form-group
 */
.cp-form-group input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.cp-form-group select,
.cp-form-group textarea,
.cp-form-input,
.cp-form-select,
.cp-form-textarea {
    /* ── 视觉规范 ── */
    width: 100%; padding: 10px 14px;
    font-size: 0.9rem; font-family: var(--cp-font);
    line-height: 1.5; box-sizing: border-box;

    background: var(--cp-surface);
    color: var(--cp-text);
    border: 1.5px solid var(--cp-border);
    border-radius: var(--cp-radius-sm);

    /* ── 交互过渡 ── */
    transition:
        border-color var(--cp-t-fast),
        box-shadow var(--cp-t-fast),
        background var(--cp-t-fast);
    appearance: none;
    -webkit-appearance: none;
}
/* select 下拉箭头 *)
.cp-form-group select,
.cp-form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238c95a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px; cursor: pointer;
}

/* ── Hover ── */
.cp-form-group input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
.cp-form-group select:hover,
.cp-form-group textarea:hover,
.cp-form-input:hover,
.cp-form-select:hover,
.cp-form-textarea:hover {
    border-color: var(--cp-primary-light);
}

/* ── Focus ── */
.cp-form-group input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.cp-form-group select:focus,
.cp-form-group textarea:focus,
.cp-form-input:focus,
.cp-form-select:focus,
.cp-form-textarea:focus {
    outline: none;
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
    background: #fff;
}

/* ── Placeholder ── */
.cp-form-group input::placeholder,
.cp-form-group textarea::placeholder,
.cp-form-input::placeholder,
.cp-form-textarea::placeholder {
    color: var(--cp-text-placeholder);
    opacity: 1;
}

/* ── Disabled ── */
.cp-form-group input:disabled,
.cp-form-group select:disabled,
.cp-form-group textarea:disabled,
.cp-form-input:disabled,
.cp-form-select:disabled,
.cp-form-textarea:disabled {
    background: #f1f5f9;
    border-color: var(--cp-border-light);
    color: var(--cp-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Readonly ── */
.cp-form-group input:read-only,
.cp-form-group textarea:read-only,
.cp-form-input:read-only,
.cp-form-textarea:read-only {
    background: var(--cp-bg);
    cursor: default;
}

/* ── Textarea 特化 ── */
.cp-form-group textarea,
.cp-form-textarea {
    resize: vertical; min-height: 120px;
    line-height: 1.7;
}

/*
 * ═══════════════════════════════════════════════
 *  ERROR / VALID STATE
 *  错误状态 — 红色边框 + 红色 ring shadow
 * ═══════════════════════════════════════════════
 */

/* ── Error modifier: container level ── */
.cp-form-group--error > input,
.cp-form-group--error > select,
.cp-form-group--error > textarea,
.cp-form-group--error > .cp-form-input,
.cp-form-group--error > .cp-form-select {
    border-color: var(--cp-danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
    background: #fff;
}

/* ── Error modifier: input level ── */
.cp-form-input--error,
.cp-form-select--error,
.cp-form-textarea--error {
    border-color: var(--cp-danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
    background: #fff;
}
/* Error group — auto-style all inputs/selects/textareas within */
.cp-form-group--error input:not([type="checkbox"]):not([type="radio"]),
.cp-form-group--error select,
.cp-form-group--error textarea {
    border-color: var(--cp-danger) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
    background: #fff;
}
.cp-form-group--error input:not([type="checkbox"]):not([type="radio"]):focus,
.cp-form-group--error select:focus,
.cp-form-group--error textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
}
.cp-form-input--error:focus,
.cp-form-select--error:focus,
.cp-form-textarea--error:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
}

/* Error message — displays below input */
.cp-form-error {
    display: flex; align-items: center; gap: 5px;
    font-size: 0.8rem; color: var(--cp-danger); font-weight: 500;
    margin-top: 2px; line-height: 1.4;
    animation: cp-shake 0.4s ease;
}
.cp-form-error::before {
    content: '\f06a';
    font-family: 'Font Awesome 7 Free', 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ── Shake animation ── */
@keyframes cp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* ── Helper / Hint text ── */
.cp-form-hint {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.78rem; color: var(--cp-text-muted);
    margin-top: 1px; line-height: 1.4;
}
.cp-form-hint::before {
    content: '\f05a';
    font-family: 'Font Awesome 7 Free', 'Font Awesome 6 Free';
    font-weight: 400;
    font-size: 0.75rem; flex-shrink: 0;
}

/* ── Global error box ── */
.cp-form-error-box {
    background: var(--cp-danger-bg); color: var(--cp-danger);
    padding: 14px 18px; border-radius: var(--cp-radius-sm);
    font-size: 0.85rem; margin-bottom: 24px;
    border-left: 4px solid var(--cp-danger);
    display: flex; align-items: flex-start; gap: 10px;
}
.cp-form-error-box::before {
    content: '\f071';
    font-family: 'Font Awesome 7 Free', 'Font Awesome 6 Free';
    font-weight: 900;
    margin-top: 1px; flex-shrink: 0;
}

/* ── Divider ── */
.cp-form-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 32px 0; color: var(--cp-text-muted); font-size: 0.82rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.cp-form-divider::before,
.cp-form-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--cp-border-light);
}

/* ── Input Group (icon + input) ── */
.cp-form-input-group {
    position: relative; display: flex; align-items: center;
}
.cp-form-input-group .cp-form-input-group__icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--cp-text-muted);
    font-size: 0.95rem; pointer-events: none; z-index: 1;
    line-height: 1;
}
.cp-form-input-group .cp-form-input,
.cp-form-input-group input {
    padding-left: 40px;
}

/* ── Form actions ── */
.cp-form-actions {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 12px; margin-top: 32px; padding-top: 24px;
    border-top: 1px solid var(--cp-border-light); flex-wrap: wrap;
}

/* ── Form card (full-page form wrapper) ── */
.cp-form-card {
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow);
    border: 1px solid var(--cp-border-light);
    padding: 32px;
}

/* ===== Dashboard Stats ===== */
.cp-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.cp-stat-card {
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow);
    border: 1px solid var(--cp-border-light);
    padding: 20px 24px;
    display: flex; align-items: center; gap: 16px;
    transition: transform var(--cp-t-fast), box-shadow var(--cp-t-fast);
}
.cp-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--cp-shadow-md);
}
.cp-stat-card__icon {
    width: 48px; height: 48px; border-radius: var(--cp-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.cp-stat-card__body { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.cp-stat-card__value {
    font-size: clamp(1.05rem, 2.2vw, 1.5rem); font-weight: 700; color: var(--cp-text);
    letter-spacing: -0.02em; line-height: 1.2;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cp-stat-card__label { font-size: 0.82rem; color: var(--cp-text-muted); }

/* ===== Metrics Row ===== */
.cp-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 24px;
}
.cp-metric {
    background: var(--cp-surface);
    border: 1px solid var(--cp-border-light);
    border-radius: var(--cp-radius);
    padding: 16px; text-align: center;
    transition: transform var(--cp-t-fast), box-shadow var(--cp-t-fast);
}
.cp-metric:hover { transform: translateY(-1px); box-shadow: var(--cp-shadow-sm); }
.cp-metric__value { display: block; font-size: 1.35rem; font-weight: 700; color: var(--cp-text); }
.cp-metric__label { display: block; font-size: 0.78rem; color: var(--cp-text-muted); margin-top: 4px; }
.cp-metric__icon { font-size: 1.1rem; color: var(--cp-text-muted); margin-top: 6px; display: block; }

/* ===== Two-column grid ===== */
.cp-two-col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}

/* ===== Info Grid (detail pages) ===== */
.cp-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}
.cp-info-item { display: flex; flex-direction: column; gap: 3px; }
.cp-info-item__label { font-size: 0.78rem; font-weight: 600; color: var(--cp-text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.cp-info-item__value { font-size: 0.92rem; color: var(--cp-text); }

/* ===== Remark Box ===== */
.cp-remark {
    background: var(--cp-bg); border-radius: var(--cp-radius-sm);
    padding: 14px 18px; font-size: 0.88rem; color: var(--cp-text-secondary);
    margin-top: 16px;
}
.cp-remark strong { color: var(--cp-text); }

/* ===== Link Row ===== */
.cp-link-row {
    display: flex; align-items: center; padding: 12px 0;
    border-bottom: 1px solid var(--cp-border-light);
    text-decoration: none; color: var(--cp-text);
    transition: background var(--cp-t-fast);
}
.cp-link-row:last-child { border-bottom: none; }
.cp-link-row:hover { background: rgba(30,58,95,0.02); }
.cp-link-row__icon { width: 36px; color: var(--cp-text-muted); text-align: center; }

/* ===== Task Row ===== */
.cp-task-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid var(--cp-border-light); flex-wrap: wrap;
}
.cp-task-row:last-child { border-bottom: none; }
.cp-task-row__title { flex: 1; font-weight: 500; min-width: 150px; }

/* ── Task priority dot ── */
.cp-task-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.cp-task-dot--danger  { background: var(--cp-danger); }
.cp-task-dot--warning { background: var(--cp-warning); }
.cp-task-dot--default { background: var(--cp-text-muted); }

/* ===== Distro Bar ===== */
.cp-distro { display: flex; flex-direction: column; gap: 12px; }
.cp-distro__item { display: flex; flex-direction: column; gap: 4px; }
.cp-distro__header { display: flex; justify-content: space-between; font-size: 0.82rem; }
.cp-distro__bar {
    height: 8px; background: var(--cp-bg-hover);
    border-radius: var(--cp-radius-full); overflow: hidden;
}
.cp-distro__fill { height: 100%; border-radius: var(--cp-radius-full); transition: width var(--cp-t-slow); }
.cp-distro__fill--1 { background: var(--cp-primary); }
.cp-distro__fill--2 { background: #3b82f6; }
.cp-distro__fill--3 { background: var(--cp-accent); }
.cp-distro__fill--4 { background: var(--cp-success); }
.cp-distro__fill--5 { background: #8b5cf6; }

/* ===== Payment Row ===== */
.cp-pay-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 0;
    border-bottom: 1px solid var(--cp-border-light);
}
.cp-pay-row:last-child { border-bottom: none; }
.cp-pay-row__amount { font-weight: 700; color: var(--cp-text); white-space: nowrap; }

/* ===== Quick Links ===== */
.cp-links {
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow);
    border: 1px solid var(--cp-border-light);
    padding: 24px;
}
.cp-links__title {
    font-size: 0.85rem; font-weight: 700; color: var(--cp-text-secondary);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px;
}
.cp-links__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.cp-links__item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--cp-radius-sm);
    background: var(--cp-bg); color: var(--cp-text-secondary);
    text-decoration: none; font-size: 0.88rem; font-weight: 500;
    transition: all var(--cp-t-fast);
}
.cp-links__item:hover {
    background: var(--cp-primary-bg); color: var(--cp-primary);
    transform: translateY(-1px);
}
.cp-links__item:focus-visible { outline: 2px solid var(--cp-primary); outline-offset: 2px; }

/* ===== Navbar — 沉浸式深色顶栏 (Glassmorphism) ===== */
.cp-nav {
    position: sticky; top: 0; z-index: 100;
    background: linear-gradient(135deg,
        rgba(30, 58, 95, 0.82) 0%,
        rgba(26, 53, 88, 0.85) 50%,
        rgba(21, 42, 69, 0.88) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 20px rgba(15, 23, 42, 0.2);
    transition: all var(--cp-t-slow);
}

/* ── 滚动后实体化 ── */
.cp-nav--scrolled {
    background: linear-gradient(135deg, var(--cp-primary) 0%, #1a3558 50%, var(--cp-primary-dark) 100%);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.35);
}

/* ── 底部发光边框 ── */
.cp-nav__glow {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(232, 168, 56, 0.15) 20%,
        rgba(232, 168, 56, 0.35) 50%,
        rgba(232, 168, 56, 0.15) 80%,
        transparent 100%);
    opacity: 0;
    transition: opacity var(--cp-t-slow);
    pointer-events: none;
}
.cp-nav--scrolled .cp-nav__glow { opacity: 1; }

/* ── 内层容器 ── */
.cp-nav__inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 60px; max-width: 1280px; margin: 0 auto; padding: 0 24px;
    position: relative; z-index: 1;
    transition: height var(--cp-t-slow);
}
.cp-nav--scrolled .cp-nav__inner { height: 56px; }

/* ── Logo ── */
.cp-nav__logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem; font-weight: 700; color: #ffffff;
    text-decoration: none; flex-shrink: 0;
    transition: all var(--cp-t-base);
    position: relative;
}
.cp-nav__logo::after {
    content: '';
    position: absolute; bottom: -2px; left: 0;
    width: 0; height: 2px;
    background: var(--cp-accent);
    border-radius: 2px;
    transition: width var(--cp-t-base);
}
.cp-nav__logo:hover { color: #fff; }
.cp-nav__logo:hover::after { width: 100%; }
.cp-nav__logo i { color: var(--cp-accent); font-size: 1.3rem; transition: transform var(--cp-t-base); }
.cp-nav__logo:hover i { transform: rotate(-10deg) scale(1.1); }

/* ── 导航链接容器 ── */
.cp-nav__links {
    display: flex; align-items: center; gap: 4px; list-style: none;
}

/* ── 导航链接（桌面端） ── */
.cp-nav__links a {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--cp-radius-sm);
    color: rgba(255, 255, 255, 0.78); text-decoration: none;
    font-size: 0.88rem; font-weight: 500;
    transition: all var(--cp-t-fast);
    position: relative;
}

/* 悬浮态 */
.cp-nav__links a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* 激活态 — 下划线指示器 */
.cp-nav__links a.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cp-accent);
    font-weight: 600;
}
.cp-nav__links a.active::after {
    content: '';
    position: absolute; bottom: 0; left: 16px; right: 16px;
    height: 2px;
    background: var(--cp-accent);
    border-radius: 2px 2px 0 0;
    transition: all var(--cp-t-base);
}

/* ── 用户信息 ── */
.cp-nav__user-info {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px;
}
.cp-nav__user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-accent), #c58a1f);
    color: var(--cp-primary-dark);
    font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.04em;
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.cp-nav__user-name {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.82rem; font-weight: 500;
    max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 桌面端下拉菜单 ── */
.cp-nav__links .nav-drop { position: relative; }
.cp-nav__links .nav-drop__toggle { cursor: pointer; user-select: none; }
.cp-nav__links .nav-drop__arrow {
    font-size: 0.5rem; opacity: 0.4;
    transition: transform var(--cp-t-base);
}
.cp-nav__links .nav-drop:hover .nav-drop__arrow {
    transform: rotate(180deg); opacity: 0.7;
}
.cp-nav__links .nav-drop__menu {
    position: absolute; top: calc(100% + 4px); left: 0;
    margin-top: 2px; min-width: 160px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 40%, #f3f6fa 100%);
    backdrop-filter: blur(16px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border-radius: var(--cp-radius);
    box-shadow:
        0 8px 32px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    list-style: none; padding: 8px 0;
    opacity: 0; visibility: hidden;
    transform: translateY(-4px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    transform-origin: top left;
}
.cp-nav__links .nav-drop:hover .nav-drop__menu {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}
/* 下拉菜单三角箭头 */
.cp-nav__links .nav-drop__menu::before {
    content: '';
    position: absolute; top: -6px; left: 20px;
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #fafbfc;
}
/* 下拉菜单项 */
.cp-nav__links .nav-drop__menu li a {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    color: var(--cp-text-secondary) !important;
    font-size: 0.84rem; font-weight: 500;
    border-radius: 0; white-space: nowrap;
    transition: all var(--cp-t-fast);
}
.cp-nav__links .nav-drop__menu li a:hover {
    background: rgba(30, 58, 95, 0.06);
    color: var(--cp-primary) !important;
}
.cp-nav__links .nav-drop__menu li a i {
    font-size: 0.78rem; color: var(--cp-text-muted);
    width: 16px; text-align: center; transition: color var(--cp-t-fast);
}
.cp-nav__links .nav-drop__menu li a:hover i {
    color: var(--cp-primary);
}

/* ── 汉堡菜单按钮 ── */
.hamburger {
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; width: 40px; height: 40px;
    background: none; border: none; cursor: pointer; padding: 0;
    z-index: 200; position: relative;
}
.hamburger span {
    display: block; width: 22px; height: 2px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}
.hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 导航覆盖层 ── */
.nav-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 98; opacity: 0;
    transition: opacity 0.35s ease;
}
.nav-overlay.active { display: block; opacity: 1; }

/* 原始 .nav-links 的桌面样式 — 保持结构兼容 */
.nav-links {
    display: flex; list-style: none; gap: 2px; align-items: center;
}
.nav-links > li > a {
    text-decoration: none; color: rgba(255, 255, 255, 0.78);
    font-weight: 500; font-size: 0.85rem;
    transition: all var(--cp-t-fast);
    padding: 6px 14px; border-radius: var(--cp-radius-sm);
    letter-spacing: 0.02em;
    display: flex; align-items: center; gap: 6px;
}
.nav-links > li > a:hover {
    color: #ffffff; background: rgba(255, 255, 255, 0.1);
}
/* 激活态（nav-links 内部） */
.nav-links > li > a.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cp-accent); font-weight: 600;
}
.nav-links > li > a.active::after {
    content: ''; position: absolute; bottom: 0; left: 14px; right: 14px;
    height: 2px; background: var(--cp-accent);
    border-radius: 2px 2px 0 0;
}

/* ── 分隔线 ── */
.nav-sep {
    width: 1px; height: 22px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 4px; flex-shrink: 0;
}

/* ── 退出按钮 ── */
.nav-logout {
    color: rgba(255, 255, 255, 0.45) !important;
    font-size: 0.82rem !important; padding: 6px 10px !important;
}
.nav-logout:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

/* ── 下拉（style.css 兼容） ── */
.nav-links .nav-drop { position: relative; }
.nav-links .nav-drop__toggle { cursor: pointer; user-select: none; }
.nav-links .nav-drop__arrow {
    font-size: 0.55rem; opacity: 0.45;
    transition: transform 0.2s ease;
}
.nav-links .nav-drop:hover .nav-drop__arrow {
    transform: rotate(180deg); opacity: 0.7;
}
.nav-links .nav-drop__menu {
    position: absolute; top: 100%; left: 0;
    margin-top: 6px; min-width: 150px;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 40%, #f3f6fa 100%);
    backdrop-filter: blur(16px) saturate(200%);
    -webkit-backdrop-filter: blur(16px) saturate(200%);
    border-radius: var(--cp-radius);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
    list-style: none; padding: 6px 0;
    opacity: 0; visibility: hidden;
    transform: translateY(-4px) scale(0.97);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}
.nav-links .nav-drop:hover .nav-drop__menu {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}
.nav-links .nav-drop__menu::before {
    content: ''; position: absolute; top: -7px; left: 20px;
    width: 0; height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #fafbfc;
}
.nav-links .nav-drop__menu li a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 18px; color: var(--cp-text-secondary) !important;
    font-size: 0.84rem; font-weight: 500;
    border-radius: 0; transition: all var(--cp-t-fast); white-space: nowrap;
}
.nav-links .nav-drop__menu li a:hover {
    background: rgba(30, 58, 95, 0.06);
    color: var(--cp-primary) !important;
}
.nav-links .nav-drop__menu li a i {
    font-size: 0.78rem; color: var(--cp-text-muted);
    width: 16px; text-align: center;
}
.nav-links .nav-drop__menu li a:hover i {
    color: var(--cp-primary);
}

/* ===== Footer ===== */
.cp-footer {
    text-align: center; padding: 24px;
    color: var(--cp-text-muted); font-size: 0.82rem;
    border-top: 1px solid var(--cp-border-light);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .cp-container { padding: 0 20px; }
    .cp-two-col { grid-template-columns: 1fr; }
    .cp-search-field--wide { grid-column: span 2; }
    /* Tablet: stats grid often fits 3 cols comfortably */
    .cp-stats-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
}
@media (max-width: 768px) {
    html { font-size: 15px; }
    .cp-container { padding: 0 16px; }

    /* ── 导航栏：移动端玻璃效果增强 ── */
    .cp-nav {
        backdrop-filter: blur(24px) saturate(200%);
        -webkit-backdrop-filter: blur(24px) saturate(200%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 2px 16px rgba(15, 23, 42, 0.3);
    }
    .cp-nav--menu-open {
        background: var(--cp-primary) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .cp-nav__inner { padding: 0 16px; height: 56px; }
    .cp-nav__glow { display: none; }

    /* ── 汉堡菜单 ── */
    .hamburger { display: flex; }

    /* ── 移动端侧边栏 ── */
    .nav-links {
        position: fixed; top: 0; right: 0;
        width: 280px; height: 100vh; height: 100dvh;
        transform: translateX(100%);
        flex-direction: column;
        background: linear-gradient(180deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
        padding: 80px 20px 32px; gap: 2px;
        z-index: 99;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s 0.4s;
        visibility: hidden;
        box-shadow: -8px 0 32px rgba(15, 23, 42, 0.35);
        overflow-y: auto; -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
        border-left: 1px solid rgba(255, 255, 255, 0.06);
    }
    .nav-links.nav-open { transform: translateX(0); visibility: visible; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0s; }
    .nav-links > li > a {
        display: block; padding: 12px 16px;
        font-size: 1rem; border-radius: var(--cp-radius);
    }
    .nav-links a i { width: 22px; text-align: center; margin-right: 4px; }

    /* ── 移动端下拉菜单 ── */
    .nav-links .nav-drop__menu {
        position: static; box-shadow: none; border: none;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        opacity: 1; visibility: visible; transform: none;
        margin-top: 0; padding: 0 0 0 24px;
        max-height: 0; overflow: hidden;
        transition: max-height 0.35s ease;
    }
    .nav-links .nav-drop.open .nav-drop__menu { max-height: 300px; }
    .nav-links .nav-drop__menu::before { display: none; }
    .nav-links .nav-drop__menu li a {
        padding: 10px 16px;
        color: rgba(255, 255, 255, 0.65) !important;
        font-size: 0.92rem; border-radius: var(--cp-radius-sm);
    }
    .nav-links .nav-drop__menu li a:hover {
        background: rgba(255, 255, 255, 0.08); color: #fff !important;
    }
    .nav-links .nav-drop__menu li a i { color: rgba(255, 255, 255, 0.3); }
    .nav-links .nav-drop__toggle .nav-drop__arrow { float: right; margin-top: 4px; }
    .nav-links .nav-drop.open .nav-drop__toggle .nav-drop__arrow { transform: rotate(180deg); }

    /* ── 移动端用户信息 ── */
    .cp-nav__user-info {
        padding: 16px 16px 12px; margin-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .cp-nav__user-avatar { width: 34px; height: 34px; font-size: 0.85rem; }
    .cp-nav__user-name { font-size: 0.9rem; color: rgba(255, 255, 255, 0.75); }

    /* 分隔线在移动端隐藏 */
    .nav-sep { display: none; }

    /* 其余响应式样式保持不变 */
    .cp-page-header { padding: 24px 0; }
    /* Fix page header decorative elements overflow */
    .cp-page-header::before,
    .cp-page-header::after { display: none; }
    .cp-header-inner { flex-direction: column; align-items: flex-start; }
    .cp-header-title h1 { font-size: 1.35rem; }
    /* Page header CTA button — full-width on tablet */
    .cp-header-inner > .cp-btn--accent,
    .cp-header-inner > .cp-btn--mobile-full,
    .cp-header-actions .cp-btn--mobile-full {
        width: 100%; justify-content: center;
    }
    /* Header action groups: stack on mobile */
    .cp-header-actions {
        width: 100%; flex-direction: column; gap: 10px;
    }
    .cp-header-stats { flex-wrap: wrap; }
    .cp-stats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .cp-stat-card { padding: 16px; gap: 10px; flex-direction: column; align-items: flex-start; }
    .cp-stat-card__icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: var(--cp-radius-sm); }
    .cp-stat-card__value { font-size: clamp(0.95rem, 3vw, 1.2rem); }
    .cp-metrics-row { grid-template-columns: repeat(2, 1fr); }
    .cp-search-row { grid-template-columns: 1fr 1fr; }
    .cp-search-field--wide { grid-column: span 2; }
    .cp-search-actions { flex-direction: row; grid-column: 1 / -1; }
    .cp-search-card { padding: 18px 16px; }
    .cp-search-field input,
    .cp-search-field select {
        font-size: 1rem; padding: 11px 14px; height: auto; min-height: 44px;
    }
    .cp-form-grid { grid-template-columns: 1fr; }
    .cp-form-card { padding: 24px 20px; }
    .cp-card__header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
    .cp-card__body { padding: 20px; }
    .cp-card__title { font-size: 0.95rem; }
    /* Table — horizontal scroll with compact cells (for non-responsive tables) */
    .cp-table:not(.cp-table--responsive) { min-width: 640px; }
    .cp-table:not(.cp-table--responsive) thead th,
    .cp-table:not(.cp-table--responsive) tbody td { padding: 10px 12px; font-size: 0.85rem; }
    .cp-table:not(.cp-table--responsive) tbody td {
        max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .cp-table:not(.cp-table--responsive) tbody td.cp-cell--name { max-width: 160px; }
    .cp-table:not(.cp-table--responsive) tbody td:last-child {
        max-width: none; overflow: visible; white-space: nowrap;
    }
    /* Tablet action cells — more compact */
    .cp-action-cell { gap: 6px; }
    .cp-action-btn { padding: 6px 12px; font-size: 0.8rem; }
    .cp-pagination { flex-direction: column; align-items: center; padding: 16px; }
    .cp-pagination__links { flex-wrap: wrap; justify-content: center; width: 100%; }
    .cp-links__grid { grid-template-columns: 1fr 1fr; }
    /* ── Form responsive ── */
    .cp-form-group input:not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    .cp-form-group select,
    .cp-form-group textarea,
    .cp-form-input, .cp-form-select, .cp-form-textarea {
        padding: 11px 16px; font-size: 1rem; /* ≥16px to prevent iOS zoom */
    }
    .cp-form-actions { flex-direction: column; }
    .cp-form-actions .cp-btn { width: 100%; justify-content: center; }
    /* ── Info grid stacks on tablet ── */
    .cp-info-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    html { font-size: 14px; }
    /* ── 小屏导航 ── */
    .cp-nav {
        backdrop-filter: blur(28px) saturate(220%);
        -webkit-backdrop-filter: blur(28px) saturate(220%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    }
    .cp-nav__inner { padding: 0 14px; height: 52px; }
    .nav-links { width: 280px; }
    .cp-page-header { padding: 20px 0; }
    .cp-header-title h1 { font-size: 1.15rem; }
    .cp-header-inner > .cp-btn--accent,
    .cp-header-inner > .cp-btn--mobile-full,
    .cp-header-actions .cp-btn--mobile-full {
        width: 100%; justify-content: center; padding: 12px 20px; font-size: 0.92rem;
    }
    /* Header action groups: stack on mobile */
    .cp-header-actions {
        width: 100%; flex-direction: column; gap: 10px;
    }
    .cp-header-stats { flex-direction: column; width: 100%; }
    .cp-stat-tag {
        width: 100%; justify-content: center;
        font-size: 0.82rem; padding: 6px 12px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .cp-stat-tag strong { font-size: 0.92rem; }
    .cp-stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .cp-stat-card { flex-direction: row; align-items: center; padding: 14px 16px; gap: 12px; }
    .cp-stat-card__icon { width: 44px; height: 44px; font-size: 1.15rem; }
    .cp-stat-card__value { font-size: clamp(1rem, 4.5vw, 1.3rem); }
    .cp-metrics-row { grid-template-columns: 1fr 1fr; }
    .cp-search-row { grid-template-columns: 1fr; }
    .cp-search-field--wide { grid-column: span 1; }
    .cp-search-actions { flex-direction: column; }
    .cp-search-actions .cp-btn { width: 100%; justify-content: center; min-height: 44px; }
    .cp-search-card { padding: 16px 14px; }
    .cp-links__grid { grid-template-columns: 1fr 1fr; }
    /* ── Form responsive ── */
    .cp-form-grid { grid-template-columns: 1fr; }
    .cp-form-card { padding: 20px 16px; }
    .cp-form-actions { flex-direction: column; align-items: stretch; }
    .cp-form-actions .cp-btn { width: 100%; justify-content: center; }
    .cp-form-group textarea,
    .cp-form-textarea { min-height: 100px; }
    /* ── Button touch targets: all btns ≥44px on small phone ── */
    .cp-btn { min-height: 44px; display: inline-flex; align-items: center; }
    .cp-btn--sm { min-height: 40px; padding: 9px 18px; font-size: 0.88rem; }
    .cp-btn--icon { min-width: 44px; min-height: 44px; width: auto; }
    .cp-action-btn { min-height: 44px; padding: 10px 14px; font-size: 0.85rem; }
    /* ── Info grid single column on phone ── */
    .cp-info-grid { grid-template-columns: 1fr; }
    .cp-card__title { font-size: 0.92rem; }
}

/* ═══════════════════════════════════════════════
   Mobile Responsive Table — Card Layout
   ≤640px: table rows become stacked cards
   ═══════════════════════════════════════════════ */
@media (max-width: 640px) {
    .cp-table--responsive {
        min-width: 0 !important;
        border: 0;
    }
    .cp-table--responsive thead {
        display: none;
    }
    .cp-table--responsive tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .cp-table--responsive tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--cp-surface);
        border: 1px solid var(--cp-border-light);
        border-radius: var(--cp-radius);
        box-shadow: var(--cp-shadow-xs);
        padding: 4px 0;
        transition: box-shadow var(--cp-t-fast), transform var(--cp-t-fast);
    }
    .cp-table--responsive tbody tr:hover {
        box-shadow: var(--cp-shadow-sm);
        transform: translateY(-1px);
        background: var(--cp-surface);
    }
    .cp-table--responsive tbody tr:focus-within {
        box-shadow: 0 0 0 2px var(--cp-primary), var(--cp-shadow-sm);
    }
    .cp-table--responsive tbody td {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border: none;
        white-space: normal !important;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: clip !important;
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.9rem;
        line-height: 1.5;
    }
    .cp-table--responsive tbody td:last-child {
        border-bottom: none;
        padding-top: 6px;
        padding-bottom: 12px;
    }
    .cp-table--responsive tbody td::before {
        content: attr(data-label);
        flex-shrink: 0;
        width: 80px;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--cp-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        white-space: nowrap;
        align-self: flex-start;
        padding-top: 2px;
    }
    /* ── Card action row ── */
    .cp-table--responsive .cp-action-cell {
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }
    .cp-table--responsive .cp-action-btn {
        flex: 1;
        min-height: 44px;
        padding: 10px 12px;
        font-size: 0.85rem;
        border-radius: var(--cp-radius-sm);
        justify-content: center;
    }
    /* Show text labels on card action buttons */
    .cp-table--responsive .cp-action-btn__label { display: inline; }
    /* ── Card sub-label (case id below name) ── */
    .cp-table--responsive .cp-table__sub-label {
        font-size: 0.78rem; margin-top: 4px;
    }
    /* ── Card table link — ensure full visibility ── */
    .cp-table--responsive .cp-table__link {
        word-break: break-word;
    }
    /* ── Card badge inside td ── */
    .cp-table--responsive .cp-badge {
        font-size: 0.82rem; padding: 4px 10px;
    }
    /* ── Card status tags ── */
    .cp-table--responsive .cp-status {
        font-size: 0.82rem; padding: 4px 12px;
    }
    /* ── Empty state inside card layout ── */
    .cp-table--responsive tbody td[colspan] {
        display: flex;
        justify-content: center;
        padding: 40px 20px;
        border: none;
    }
    .cp-table--responsive tbody td[colspan]::before {
        display: none;
    }
    /* ── Card pagination touch-friendly ── */
    .cp-pagination {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
        gap: 10px;
    }
    .cp-pagination__links {
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }
    .cp-pagination__btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
        min-height: 44px;
        font-size: 0.9rem;
    }
    .cp-pagination__info {
        text-align: center;
        padding: 10px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════
   Landscape / Orientation Adaptation
   ═══════════════════════════════════════════════ */
@media (max-width: 896px) and (orientation: landscape) {
    /* Landscape nav: compact but clearly visible */
    .cp-nav__inner { height: 52px; padding: 0 18px; }
    .cp-nav__logo { font-size: 1.05rem; }
    /* On landscape phones, cards can be wider but still card layout */
    .cp-table--responsive tbody {
        gap: 10px;
    }
    .cp-table--responsive tbody tr {
        flex-direction: row; flex-wrap: wrap;
        padding: 8px 0;
    }
    .cp-table--responsive tbody td {
        flex: 1 1 50%;
        min-width: 180px;
        padding: 8px 12px;
    }
    .cp-table--responsive tbody td:last-child {
        flex: 1 1 100%;
        border-top: 1px solid #f3f4f6;
        border-bottom: none;
        padding-top: 10px;
        padding-bottom: 8px;
    }
    /* Landscape: adjust font scaling */
    html { font-size: 15px; }
    .cp-stats-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .cp-stat-card { padding: 12px 14px; gap: 10px; }
    .cp-stat-card__icon { width: 36px; height: 36px; font-size: 1rem; }
    .cp-stat-card__value { font-size: clamp(0.9rem, 2.5vw, 1.15rem); }
}

/* ═══════════════════════════════════════════════
   Extra Small Phones (≤380px)
   ═══════════════════════════════════════════════ */
@media (max-width: 380px) {
    html { font-size: 13px; }
    .cp-container { padding: 0 12px; }
    /* 超小屏导航紧凑态 */
    .cp-nav__inner { padding: 0 12px; height: 48px; }
    .nav-links { width: 260px; }
    .cp-nav__logo { font-size: 1rem; }
    .cp-page-header { padding: 16px 0; }
    .cp-header-title h1 { font-size: 1.05rem; }
    .cp-search-card { padding: 14px 12px; }
    .cp-search-card__label { font-size: 0.78rem; margin-bottom: 14px; }
    .cp-search-field label { font-size: 0.75rem; }
    .cp-card__header { padding: 12px 14px; }
    .cp-card__body { padding: 16px 12px; }
    .cp-table--responsive tbody td {
        padding: 8px 12px;
        gap: 8px;
    }
    .cp-table--responsive tbody td::before {
        width: 65px;
        font-size: 0.7rem;
    }
    .cp-table--responsive .cp-action-btn {
        min-height: 40px; padding: 8px 10px; font-size: 0.8rem;
    }
    .cp-btn { min-height: 40px; padding: 9px 16px; }
    .cp-stat-card { padding: 12px 14px; gap: 10px; }
    .cp-stat-card__icon { width: 38px; height: 38px; font-size: 1rem; }
    .cp-pagination__btn { min-height: 40px; padding: 8px 14px; font-size: 0.85rem; }
    .cp-pagination__info { min-height: 40px; padding: 8px 14px; font-size: 0.85rem; }
}

/* ===== Back Link ===== */
.cp-back-link {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 9px 18px 9px 12px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; color: var(--cp-text-secondary);
    text-decoration: none; font-size: 0.85rem; font-weight: 500;
    transition: all var(--cp-t-fast); line-height: 1;
}
.cp-back-link__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 7px;
    background: #e8ecf1; color: #64748b;
    font-size: 0.65rem; transition: all var(--cp-t-fast); flex-shrink: 0;
}
.cp-back-link:hover {
    background: #fff; border-color: #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05); color: var(--cp-primary);
}
.cp-back-link:hover .cp-back-link__icon { background: var(--cp-primary); color: #fff; }
.cp-back-link:active { transform: scale(0.98); }

/* ===== Step Indicator ===== */
.cp-step {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-size: 0.8rem; font-weight: 700; flex-shrink: 0;
    line-height: 1;
}
.cp-step--primary { background: var(--cp-primary); color: #fff; }
.cp-step--muted   { background: var(--cp-text-muted); color: #fff; }
.cp-step--accent  { background: var(--cp-accent); color: #fff; }

/* ===== Section Label (step header) ===== */
.cp-section-label {
    display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
    font-weight: 600; font-size: 0.95rem; color: var(--cp-text);
    line-height: 1.4;
}

/* ===== Search Dropdown ===== */
.cp-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
    background: var(--cp-surface); border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-sm); box-shadow: var(--cp-shadow-lg);
    max-height: 300px; overflow-y: auto; display: none;
}
.cp-dropdown-item {
    padding: 12px 14px; cursor: pointer;
    border-bottom: 1px solid var(--cp-border-light);
    transition: background var(--cp-t-fast);
}
.cp-dropdown-item:last-child { border-bottom: none; }
.cp-dropdown-item:hover,
.cp-dropdown-item--active {
    background: rgba(37,99,235,0.06);
    border-left: 3px solid var(--cp-primary);
}

/* ===== Quick Archive Search ===== */
.cp-quick-archive-search {
    position: relative;
    display: flex;
    align-items: center;
}
.cp-quick-archive-search__icon {
    position: absolute;
    left: 14px;
    color: var(--cp-text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1;
}
.cp-quick-archive-search__input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius);
    font-size: 0.92rem;
    background: var(--cp-surface);
    color: var(--cp-text);
    outline: none;
    transition: border-color var(--cp-t-fast), box-shadow var(--cp-t-fast);
}
.cp-quick-archive-search__input:focus {
    border-color: var(--cp-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.cp-quick-archive-search__clear,
.cp-quick-archive-search__spinner {
    position: absolute;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--cp-text-muted);
    cursor: pointer;
    border-radius: 50%;
    font-size: 0.85rem;
    z-index: 1;
    transition: background var(--cp-t-fast), color var(--cp-t-fast);
}
.cp-quick-archive-search__clear:hover {
    background: var(--cp-bg);
    color: var(--cp-text);
}
.cp-quick-archive-search__spinner {
    cursor: default;
    color: var(--cp-primary);
}

/* ===== Variable Chip ===== */
.cp-var-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.cp-var-chip {
    padding: 10px 12px; background: var(--cp-bg);
    border-radius: var(--cp-radius-sm);
}
.cp-var-chip__key {
    font-size: 0.78rem; color: var(--cp-primary);
    display: block; margin-bottom: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}
.cp-var-chip__val {
    font-size: 0.82rem; color: var(--cp-text-secondary);
    word-break: break-all;
}

/* ===== Case Info Card (selected case display) ===== */
.cp-case-card {
    padding: 14px; background: var(--cp-bg);
    border-radius: var(--cp-radius);
}
.cp-case-card__header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 6px;
}
.cp-case-card__no { font-weight: 700; color: var(--cp-primary); }
.cp-case-card__name { margin-left: 8px; }
.cp-case-card__meta {
    font-size: 0.82rem; color: var(--cp-text-muted);
    display: flex; align-items: center; gap: 4px;
    line-height: 1.4;
}
.cp-case-card__meta i,
.cp-case-card__meta .fa,
.cp-case-card__meta .fa-solid {
    line-height: 1;
    flex-shrink: 0;
}

/* ===== Doc Generate Layout ===== */
.cp-docgen-layout {
    display: flex; gap: 24px; align-items: flex-start;
    padding: 0 24px; flex-wrap: wrap;
    max-width: 1280px; margin: 0 auto;
}
.cp-docgen-col {
    flex: 1; min-width: 320px;
    display: flex; flex-direction: column; gap: 20px;
}
.cp-docgen-col--wide { min-width: 360px; }

/* ===== Generate Action ===== */
.cp-generate-actions {
    text-align: center; padding: 24px 0;
}
.cp-generate-actions .cp-btn {
    font-size: 1.05rem; padding: 14px 32px; width: 100%;
}
.cp-generate-hint {
    margin-top: 12px; font-size: 0.84rem;
    color: var(--cp-text-muted);
}

/* ===== Template Card Grid (文书生成) ===== */
.cp-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.cp-template-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 16px;
    background: var(--cp-bg);
    border: 1.5px solid var(--cp-border);
    border-radius: var(--cp-radius);
    cursor: pointer;
    text-align: left;
    transition: all var(--cp-t-fast);
    font-family: inherit;
    font-size: inherit;
    color: var(--cp-text);
}
.cp-template-card:hover {
    border-color: var(--cp-primary);
    background: var(--cp-primary-bg);
    box-shadow: 0 2px 8px rgba(30,58,95,0.08);
}
.cp-template-card--active,
.cp-template-card[aria-pressed="true"] {
    border-color: var(--cp-primary);
    background: var(--cp-primary-bg);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}
.cp-template-card__icon {
    font-size: 1.3rem;
    color: var(--cp-primary);
    line-height: 1;
}
.cp-template-card--active .cp-template-card__icon,
.cp-template-card[aria-pressed="true"] .cp-template-card__icon {
    color: var(--cp-primary);
}
.cp-template-card__name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
}
.cp-template-card__type {
    font-size: 0.75rem;
    color: var(--cp-text-muted);
}

/* DocGen Results layout */
.cp-docgen-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    .cp-docgen-results {
        grid-template-columns: 1fr;
    }
}

/* ===== Template Chips (compact selector) ===== */
.cp-tpl-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.cp-tpl-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px;
    border: 1.5px solid var(--cp-border);
    border-radius: var(--cp-radius-full);
    background: var(--cp-bg);
    font-size: 0.82rem; font-weight: 500; color: var(--cp-text-secondary);
    cursor: pointer; transition: all var(--cp-t-fast);
    font-family: inherit; line-height: 1.3;
}
.cp-tpl-chip:hover {
    border-color: var(--cp-primary); background: var(--cp-primary-bg);
    color: var(--cp-primary);
}
.cp-tpl-chip--active,
.cp-tpl-chip[aria-selected="true"] {
    border-color: var(--cp-primary); background: var(--cp-primary-bg);
    color: var(--cp-primary); font-weight: 600;
}
.cp-tpl-chip i { font-size: 0.85rem; opacity: 0.65; }
.cp-tpl-chip--active i,
.cp-tpl-chip[aria-selected="true"] i { opacity: 1; }

/* ===== DocGen Divider ===== */
.cp-docgen-divider {
    display: flex; align-items: center; gap: 6px;
    margin-top: 16px; padding-bottom: 10px;
    border-bottom: 1px solid var(--cp-border-light);
    font-size: 0.82rem; color: var(--cp-text-muted);
}
.cp-docgen-divider i { color: var(--cp-primary); }
.cp-docgen-divider__type {
    margin-left: auto; font-size: 0.75rem;
    background: var(--cp-bg-hover); padding: 2px 8px;
    border-radius: var(--cp-radius-full);
}

/* ===== DocGen Preview ===== */
.cp-docgen-preview { margin-bottom: 12px; }

/* ===== DocGen Bottom Bar ===== */
.cp-docgen-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
}
.cp-docgen-bar__toggle {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    background: transparent; border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-sm);
    font-size: 0.8rem; color: var(--cp-text-muted);
    cursor: pointer; font-family: inherit;
    transition: all var(--cp-t-fast);
}
.cp-docgen-bar__toggle:hover {
    border-color: var(--cp-primary); color: var(--cp-primary);
}

/* ===== DocGen Variable List ===== */
.cp-docgen-vars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 3px; margin-top: 12px;
    padding: 10px 12px;
    background: var(--cp-bg); border-radius: var(--cp-radius);
    border: 1px solid var(--cp-border-light);
}
.cp-docgen-vars__row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 8px; font-size: 0.78rem;
    background: var(--cp-surface); border-radius: 4px;
}
.cp-docgen-vars__row :first-child { font-weight: 600; color: var(--cp-text-secondary); }
.cp-docgen-vars__row :last-child  { color: var(--cp-text); }

/* ===== File Template Note ===== */
.cp-file-tpl-note {
    margin-bottom: 12px; padding: 10px 14px;
    background: #eff6ff; border-radius: var(--cp-radius-sm);
    font-size: 0.82rem; color: #2563eb;
    border: 1px solid #bfdbfe;
    display: flex; align-items: center; gap: 6px;
    line-height: 1.4;
}
.cp-file-tpl-note i,
.cp-file-tpl-note .fa,
.cp-file-tpl-note .fa-solid {
    line-height: 1;
    flex-shrink: 0;
}

/* ===== Content Preview ===== */
.cp-content-preview {
    background: var(--cp-bg); border-radius: var(--cp-radius-sm);
    padding: 20px; min-height: 200px; max-height: 500px;
    overflow-y: auto; font-size: 0.9rem; line-height: 1.8;
    white-space: pre-wrap;
}

/* ===== Empty State ===== */
.cp-empty-state {
    text-align: center; padding: 24px; color: var(--cp-text-muted);
    background: var(--cp-bg); border-radius: var(--cp-radius);
}
.cp-empty-state i { display: block; font-size: 1.5rem; margin-bottom: 8px; }
.cp-empty-state p { margin: 0; }

/* ===== Template Badge ===== */
.cp-tpl-badge {
    margin-left: auto; font-size: 0.75rem;
    background: #eff6ff; color: #2563eb;
    padding: 2px 10px; border-radius: 100px;
    display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid #bfdbfe;
    line-height: 1.4;
}
.cp-tpl-badge i,
.cp-tpl-badge .fa,
.cp-tpl-badge .fa-solid {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* ===== Responsive: Doc Generate ===== */
@media (max-width: 768px) {
    .cp-docgen-layout { padding: 0 16px; gap: 16px; }
    .cp-docgen-col { min-width: 100%; flex: none; width: 100%; }
    .cp-var-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 480px) {
    .cp-var-grid { grid-template-columns: 1fr 1fr; }
    .cp-content-preview { max-height: 350px; }
}

/* ===== Form Field Error Hint ===== */
.cp-form-error-hint {
    display: block; color: var(--cp-danger); font-size: 0.8rem;
    margin-top: 4px;
}

/* ===== Template Type Switch (moved from template) ===== */
.cp-type-switch { display:flex;gap:12px;flex-wrap:wrap; }
.cp-type-option { display:flex;align-items:flex-start;gap:10px;padding:16px 18px;
    border:2px solid var(--cp-border);border-radius:var(--cp-radius);cursor:pointer;
    transition:all var(--cp-t-fast);flex:1;min-width:200px; }
.cp-type-option:hover { border-color:var(--cp-primary);background:rgba(37,99,235,0.03); }
.cp-type-option input[type="radio"] { margin-top:4px;flex-shrink:0; }
.cp-type-option input[type="radio"]:checked + .cp-type-option__body { color:var(--cp-primary); }
.cp-type-option:has(input:checked) { border-color:var(--cp-primary);background:rgba(37,99,235,0.05); }
.cp-type-option__body { display:flex;flex-direction:column;gap:4px; }
.cp-type-option__icon { font-size:1.2rem;color:var(--cp-text-muted); }
.cp-type-option__title { font-weight:600;font-size:0.92rem; }
.cp-type-option__desc { font-size:0.78rem;color:var(--cp-text-muted); }
.cp-type-option-hint {
    font-size: 0.8rem; color: var(--cp-text-muted);
    margin: 0 0 12px 0;
}

/* ===== File Drop Zone ===== */
.cp-file-drop {
    border: 2px dashed var(--cp-border);
    border-radius: var(--cp-radius);
    padding: 40px 20px; text-align: center;
    transition: all var(--cp-t-fast);
    cursor: default;
}
.cp-file-drop--active {
    border-color: var(--cp-primary);
    background: rgba(37,99,235,0.04);
}
.cp-file-drop__icon {
    font-size: 2.5rem; color: var(--cp-text-muted);
    margin-bottom: 12px; display: block;
}
.cp-file-drop__text { margin: 0 0 4px; }
.cp-file-drop__hint {
    font-size: 0.8rem; color: var(--cp-text-muted);
    margin: 0 0 16px;
}
.cp-file-drop__success {
    color: #16a34a; margin-right: 6px;
}

/* ===== Current File Info ===== */
.cp-file-info {
    margin-top: 12px; padding: 10px 14px;
    background: var(--cp-bg); border-radius: var(--cp-radius-sm);
    font-size: 0.88rem;
}
.cp-file-info__icon { color: #2563eb; }
.cp-file-info__size { color: var(--cp-text-muted); }

/* ===== Variable Tag (clickable chip) ===== */
.cp-var-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px;
    background: var(--cp-bg); color: var(--cp-text-secondary);
    border: 1px solid var(--cp-border-light);
    border-radius: var(--cp-radius-sm);
    font-size: 0.78rem; font-weight: 500;
    cursor: pointer; transition: all var(--cp-t-fast);
    font-family: inherit; margin: 2px;
}
.cp-var-tag:hover {
    background: var(--cp-primary); color: #fff;
    border-color: var(--cp-primary);
}
.cp-var-tag:active { transform: scale(0.97); }

/* ===== Variable Reference Box ===== */
.cp-var-ref {
    margin-top: 16px; padding: 16px;
    background: var(--cp-bg); border-radius: var(--cp-radius);
}
.cp-var-ref__title {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.88rem; font-weight: 600; color: var(--cp-text);
    margin: 0 0 8px;
}
.cp-var-ref__title i { color: var(--cp-primary); }
.cp-var-ref__hint {
    font-size: 0.8rem; color: var(--cp-text-muted);
    margin: 0 0 10px;
}
.cp-var-ref__hint code {
    background: var(--cp-surface); padding: 1px 6px;
    border-radius: 4px; font-size: 0.85rem;
}
.cp-var-ref__chips {
    display: flex; flex-direction: column; gap: 12px;
}
.cp-var-ref__group {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.cp-var-ref__group-title {
    width: 100%;
    font-size: 0.76rem; font-weight: 600;
    color: var(--cp-text-secondary);
    margin: 0 0 2px;
}

/* ===== Variable Panel (card variant) ===== */
.cp-var-panel {
    min-width: 220px; align-self: start;
    padding: 18px; background: var(--cp-surface);
    border-radius: var(--cp-radius); border: 1px solid var(--cp-border-light);
}
.cp-var-panel__title {
    font-size: 0.9rem; font-weight: 600; color: var(--cp-text);
    margin: 0 0 6px;
    display: flex; align-items: center; gap: 6px;
}
.cp-var-panel__title i { color: var(--cp-primary); }
.cp-var-panel__hint {
    font-size: 0.76rem; color: var(--cp-text-muted);
    margin: 0 0 12px;
}
.cp-var-panel__group {
    margin-bottom: 12px;
}
.cp-var-panel__group-title {
    font-size: 0.76rem; font-weight: 600;
    color: var(--cp-text-secondary);
    margin: 0 0 6px;
}

/* ===== Utility: sr-only ===== */
.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap;
}

/* ===== Utility: display none ===== */
.cp-d-none { display: none !important; }

/* ===== Tabs ===== */
.cp-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.cp-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--cp-radius);
    font-size: 0.88rem; font-weight: 500; text-decoration: none;
    color: var(--cp-text-muted); background: var(--cp-card-bg);
    border: 1px solid var(--cp-border);
    transition: all var(--cp-t-fast);
}
.cp-tab:hover { color: var(--cp-primary); border-color: var(--cp-primary); }
.cp-tab--active {
    color: #fff; background: var(--cp-primary); border-color: var(--cp-primary);
}

/* ===== Content Editor (template textarea) ===== */
.cp-content-editor textarea {
    min-height: 360px !important;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.88rem;
    line-height: 1.75;
}

/* ===== Scroll Lock (menu open) ===== */
/* iOS-safe: 使用 html 级别锁定，避免 zoom 时视口跳变 */
html.menu-open,
html.menu-open body {
    overflow: hidden;
    /* 防止 iOS 缩放时 fixed 元素偏移 */
    -webkit-overflow-scrolling: auto;
}
/* 在支持 dvh 的浏览器使用动态视口高度 */
@supports (height: 100dvh) {
    html.menu-open,
    html.menu-open body {
        height: 100dvh;
    }
}

/* ===== Modal / 弹窗 ===== */
.cp-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px; /* 小屏兜底，防止内容贴边 */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cp-modal-fade-in 0.2s ease;
    /* 缩放安全 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.cp-modal-content {
    position: relative;
    background: var(--cp-surface);
    border-radius: var(--cp-radius-lg, 12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: cp-modal-slide-up 0.25s ease;
    /* 防止 iOS 缩放时弹窗跑到屏幕外 */
    margin: auto;
}
.cp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--cp-border-light);
}
.cp-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cp-text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cp-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--cp-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--cp-radius-sm);
    transition: background var(--cp-t-fast), color var(--cp-t-fast);
}
.cp-modal-close:hover {
    background: var(--cp-bg-hover);
    color: var(--cp-text);
}
.cp-modal-body {
    padding: 20px 24px;
}
.cp-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--cp-border-light);
}

/* 弹窗动画 */
@keyframes cp-modal-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes cp-modal-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 弹窗内的切换按钮 */
.type-toggle {
    display: inline-flex;
    background: var(--cp-bg);
    border-radius: var(--cp-radius);
    padding: 3px;
    gap: 2px;
}
.type-toggle-btn {
    padding: 6px 20px;
    border: none;
    background: transparent;
    border-radius: var(--cp-radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--cp-text-muted);
    cursor: pointer;
    transition: all var(--cp-t-fast);
}
.type-toggle-btn.active {
    background: var(--cp-surface);
    color: var(--cp-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.type-toggle-btn:not(.active):hover {
    color: var(--cp-text);
}

/* 弹窗内表单样式 */
.cp-modal-body .cp-form-group { margin-bottom: 16px; }
.cp-modal-body .cp-form-group:last-child { margin-bottom: 0; }
.cp-form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--cp-text);
    margin-bottom: 6px;
}
.cp-form-required { color: var(--cp-danger); }

/* 弹窗响应式 */
@media (max-width: 576px) {
    .cp-modal-content {
        width: 95%;
        max-height: 85vh;
        max-height: 85dvh;
        border-radius: 10px;
    }
    .cp-modal-header { padding: 16px 18px 14px; }
    .cp-modal-body  { padding: 16px 18px; }
    .cp-modal-footer { padding: 14px 18px 16px; }
}

/* ═══════════════════════════════════════════════
   iOS Safari Zoom Compatibility Patches
   ═══════════════════════════════════════════════ */
@supports (-webkit-touch-callout: none) {
    /* iOS 缩放时 fixed 元素视口修正 */
    .cp-modal-overlay,
    .nav-overlay {
        /* 使用 -webkit-fill-available 替代 inset:0，缩放时更稳定 */
        width: 100vw; height: 100vh;
        width: 100dvw; height: 100dvh;
        top: 0; left: 0;
    }

    /* iOS 缩放时防止侧边栏 fixed 定位偏移 */
    .nav-links {
        width: 280px; max-width: 85vw;
        /* 确保在任意缩放级别都从右侧滑入 */
        will-change: transform;
    }

    /* 弹窗内容缩放自适应 — 强制 GPU 合成避免闪烁 */
    .cp-modal-content {
        will-change: transform;
    }
}

/* 禁用固定定位元素在缩放时的意外滚动 */
.nav-links,
.cp-modal-overlay,
.nav-overlay {
    -webkit-overflow-scrolling: touch;
}

/* 按钮和交互元素：禁止双击缩放和长按菜单 */
.hamburger,
.nav-links a,
.nav-links button,
.cp-modal-close,
.cp-btn {
    touch-action: manipulation;
}
