/* ==========================================================================
   NewCMS Admin · "Meridian Tech" Design System
   普鲁士蓝 × 钢银 × 琥珀点缀 · 商务科技 · 移动优先
   技术栈：Tailwind v3 CDN + 原生 CSS 变量 + Vanilla JS
   字体策略：纯系统字体栈，无外部 CDN 依赖
   ========================================================================== */

/* ===== Tailwind 配置（CDN 模式下通过 tailwind.config 注入） ===== */
/* 配置在 AdminLayout.php 中通过 <script>tailwind.config = {...}</script> 注入 */

/* ===== 1. 设计令牌（CSS 变量，支持暗色覆盖） ===== */
:root {
    /* —— 主色调：Meridian Prussian —— */
    --primary: #0F2A4A;          /* 普鲁士蓝 — 主色 */
    --primary-deep: #0A1F38;     /* 深普鲁士 */
    --primary-soft: #E8EEF5;     /* 蓝雾底 */
    --primary-border: #BFD0E3;   /* 蓝雾边 */

    /* —— 强调色：Amber Pulse —— */
    --accent: #D97706;           /* 琥珀 — CTA/active */
    --accent-deep: #B45309;      /* 深琥珀 */
    --accent-soft: #FEF3C7;      /* 琥珀底 */

    /* —— 中性色：Steel —— */
    --ink: #0F172A;              /* 钢墨 — 主文字 */
    --ink-soft: #334155;         /* 次级文字 */
    --ink-mute: #64748B;         /* 弱化文字 */
    --ink-faint: #94A3B8;        /* 辅助文字 */

    --paper: #F8FAFC;            /* 象牙白 — 主背景 */
    --paper-warm: #F1F5F9;       /* 雾银 — 次背景 */
    --paper-card: #FFFFFF;       /* 卡片纯白 */

    --rule: #E2E8F0;             /* 分隔线 */
    --rule-soft: #EEF2F6;        /* 细分隔线 */
    --rule-strong: #CBD5E1;      /* 强分隔线 */

    /* —— 语义色 —— */
    --moss: #15803D;             /* 苔绿 — 成功 */
    --moss-soft: #DCFCE7;
    --ember: #DC2626;            /* 余烬红 — 危险 */
    --ember-soft: #FEE2E2;
    --gold: #B45309;             /* 暗金 — 警告 */
    --gold-soft: #FEF3C7;
    --info: #1E40AF;             /* 深靛 — 信息 */
    --info-soft: #DBEAFE;
    --cyan: #0891B2;             /* 青蓝 — 提示 */
    --cyan-soft: #CFFAFE;

    /* —— 文字别名 —— */
    --text: var(--ink);
    --text-muted: var(--ink-mute);
    --text-faint: var(--ink-faint);
    --text-inverse: #FFFFFF;

    /* —— 字体：纯系统字体栈，跨平台覆盖 —— */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Menlo", "Monaco", "Cascadia Code", "Consolas", "Liberation Mono", "Courier New", monospace;
    --font-display: var(--font-sans); /* 商务风用无衬线作展示字体 */

    /* —— 尺度 —— */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-pill: 999px;

    --sidebar-w: 240px;
    --sidebar-w-collapsed: 72px;
    --topbar-h: 56px;
    --content-max: 1400px;

    /* —— 阴影：极克制 —— */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    --shadow-primary: 0 4px 14px rgba(15, 42, 74, 0.25);
    --shadow-accent: 0 4px 14px rgba(217, 119, 6, 0.30);

    /* —— 过渡 —— */
    --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 320ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 暗色主题：Midnight Steel ===== */
html[data-theme="dark"] {
    --primary: #5B8AC6;
    --primary-deep: #3B6BA8;
    --primary-soft: #1A2438;
    --primary-border: #2A3A55;

    --accent: #F59E0B;
    --accent-deep: #D97706;
    --accent-soft: #2A1F0A;

    --ink: #E2E8F0;
    --ink-soft: #CBD5E1;
    --ink-mute: #94A3B8;
    --ink-faint: #64748B;

    --paper: #0B1220;
    --paper-warm: #111A2E;
    --paper-card: #151F33;

    --rule: #1E293B;
    --rule-soft: #18233A;
    --rule-strong: #334155;

    --moss: #4ADE80;
    --moss-soft: #0F2A1A;
    --ember: #F87171;
    --ember-soft: #2A1010;
    --gold: #FBBF24;
    --gold-soft: #2A2008;
    --info: #60A5FA;
    --info-soft: #0F1825;
    --cyan: #22D3EE;
    --cyan-soft: #0A2A30;

    --text: var(--ink);
    --text-muted: var(--ink-mute);
    --text-faint: var(--ink-faint);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --shadow-primary: 0 4px 14px rgba(91, 138, 198, 0.25);
    --shadow-accent: 0 4px 14px rgba(245, 158, 11, 0.30);
}

/* ===== 2. 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: background-color var(--t-base), color var(--t-base);
}
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--t-fast);
}
a:hover { color: var(--accent); }
img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea {
    font: inherit;
    color: inherit;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* 等宽数字 */
.tnum, table, .stat-num, .mono {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

/* ===== 3. 布局：Sidebar + Topbar + Main ===== */
.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    min-height: 100vh;
}

/* —— Sidebar —— */
.admin-sidebar {
    grid-area: sidebar;
    background: var(--primary-deep);
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 30;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%),
        radial-gradient(circle at 100% 0%, rgba(217, 119, 6, 0.06) 0%, transparent 40%);
}
html[data-theme="dark"] .admin-sidebar {
    background: var(--primary-deep);
}

.sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
    box-shadow: var(--shadow-accent);
    flex-shrink: 0;
}
.sidebar-brand .brand-text {
    min-width: 0;
    flex: 1;
}
.sidebar-brand .mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-brand .tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-top: 2px;
    display: block;
}

.sidebar-section {
    padding: 12px 0 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.sidebar-section:last-child { border-bottom: 0; }
.sidebar-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.4);
    padding: 6px 20px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent);
}

.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.sidebar-nav li { margin: 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--t-fast);
    position: relative;
}
.sidebar-nav a:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 255, 255, 0.2);
}
.sidebar-nav a.is-active {
    color: #FFFFFF;
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.15) 0%, rgba(217, 119, 6, 0.03) 100%);
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-nav a.is-active::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}
.sidebar-nav a .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
}
.sidebar-nav a.is-active .icon { opacity: 1; color: var(--accent); }
.sidebar-nav a .badge-num {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    background: var(--accent);
    color: #FFFFFF;
    border-radius: var(--radius-pill);
    line-height: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
    font-family: var(--font-mono);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-footer a {
    color: rgba(255, 255, 255, 0.65);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sidebar-footer a:hover { color: var(--accent); }

/* —— Topbar —— */
.admin-topbar {
    grid-area: topbar;
    background: var(--paper-card);
    border-bottom: 1px solid var(--rule);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow-xs);
}
.topbar-toggle {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    transition: all var(--t-fast);
}
.topbar-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}
.topbar-toggle svg { width: 18px; height: 18px; }

.topbar-crumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
}
.topbar-crumb .sep {
    color: var(--text-faint);
    font-family: var(--font-mono);
}
.topbar-crumb .crumb-root {
    font-weight: 500;
    color: var(--primary);
}
.topbar-crumb .crumb-current {
    color: var(--ink);
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-search {
    position: relative;
    width: 260px;
    max-width: 32vw;
}
.topbar-search input {
    width: 100%;
    height: 36px;
    padding: 0 12px 0 36px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text);
    transition: all var(--t-fast);
}
.topbar-search input:focus {
    outline: 0;
    border-color: var(--primary);
    background: var(--paper-card);
    box-shadow: 0 0 0 3px rgba(15, 42, 74, 0.08);
}
html[data-theme="dark"] .topbar-search input:focus {
    box-shadow: 0 0 0 3px rgba(91, 138, 198, 0.15);
}
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-faint);
    pointer-events: none;
}
.topbar-search kbd {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-faint);
    background: var(--paper-warm);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    pointer-events: none;
}

.topbar-theme {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: all var(--t-fast);
}
.topbar-theme:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: rotate(15deg);
}
.topbar-theme svg { width: 16px; height: 16px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid var(--rule);
}
.topbar-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}
.topbar-user .uname {
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    line-height: 1.2;
}
.topbar-user .logout {
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
    display: block;
}
.topbar-user .logout:hover { color: var(--ember); }

/* —— Main —— */
.admin-main {
    grid-area: main;
    padding: 28px 32px 64px;
    min-width: 0;
    overflow-x: hidden;
    background: var(--paper);
}
.admin-main > .container {
    max-width: var(--content-max);
    margin: 0 auto;
}

/* ===== 4. 页面头部 ===== */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--rule);
}
.page-head .title-block { min-width: 0; flex: 1; }
.page-head h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-head h1 em {
    color: var(--accent);
    font-style: normal;
    font-weight: 700;
}
.page-head h1::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}
.page-head .subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    padding-left: 16px;
}
.page-head .actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ===== 5. 卡片（Flowbite 风格） ===== */
.card {
    background: var(--paper-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base);
}
.card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-lift);
}
.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rule);
    gap: 12px;
}
.card-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-head h3::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-pill);
}
.card-head .actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-grid {
    display: grid;
    gap: 16px;
}
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== 6. 统计指标 ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: var(--paper-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--t-base);
}
.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    opacity: 0;
    transition: opacity var(--t-base);
}
.stat:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}
.stat:hover::before { opacity: 1; }
.stat .label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat .label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
}
.stat .num {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 30px;
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat .delta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.stat .delta.up { color: var(--moss); }
.stat .delta.up::before { content: '▲'; font-size: 9px; }
.stat .delta.down { color: var(--ember); }
.stat .delta.down::before { content: '▼'; font-size: 9px; }

/* ===== 7. 按钮（Flowbite 风格） ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 18px;
    background: var(--paper-card);
    color: var(--ink-soft);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-lg);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-sans);
    line-height: 1;
    cursor: pointer;
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    box-shadow: 0 1px 2px rgba(15, 42, 74, 0.04);
}
.btn:hover {
    background: var(--paper-warm);
    border-color: var(--ink-mute);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(15, 42, 74, 0.25);
}
.btn-primary:hover {
    background: var(--primary-deep);
    border-color: var(--primary-deep);
    color: #FFFFFF;
    box-shadow: 0 4px 8px -2px rgba(15, 42, 74, 0.35);
}
.btn-accent {
    background: var(--accent);
    color: #FFFFFF;
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.25);
}
.btn-accent:hover {
    background: var(--accent-deep);
    border-color: var(--accent-deep);
    color: #FFFFFF;
    box-shadow: 0 4px 8px -2px rgba(217, 119, 6, 0.35);
}
.btn-ghost {
    background: transparent;
    border-color: var(--rule);
    color: var(--text-muted);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--paper-warm);
    color: var(--ink);
    border-color: var(--rule-strong);
    box-shadow: none;
}
.btn-danger {
    background: var(--paper-card);
    color: var(--ember);
    border-color: var(--ember);
}
.btn-danger:hover {
    background: var(--ember);
    color: #FFFFFF;
    border-color: var(--ember);
    box-shadow: 0 4px 8px -2px rgba(220, 38, 38, 0.35);
}
.btn-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: #A7C1EE;
    box-shadow: none;
}
.btn-info:hover {
    background: var(--info);
    color: #FFFFFF;
    border-color: var(--info);
    box-shadow: 0 4px 8px -2px rgba(30, 64, 175, 0.35);
}
.btn-link {
    background: transparent;
    border-color: transparent;
    color: var(--primary);
    padding: 0 8px;
    box-shadow: none;
}
.btn-link:hover {
    background: var(--primary-soft);
    color: var(--primary-deep);
    border-color: transparent;
    box-shadow: none;
    transform: none;
}
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: var(--radius); }
.btn-lg { height: 46px; padding: 0 24px; font-size: 14px; border-radius: var(--radius-lg); }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ===== 8. 表格（Flowbite 风格） ===== */
.table-wrap {
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    background: var(--paper-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.table-wrap.is-scroll { overflow-x: auto; }

/* 统一表格样式：同时支持 .table 和 table.data-table 两种写法 */
table.table,
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.table th,
table.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--paper-warm);
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
}
table.table td,
table.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--rule-soft);
    color: var(--text);
    vertical-align: middle;
}
table.table tbody tr,
table.data-table tbody tr {
    transition: background var(--t-fast);
    position: relative;
}
table.table tbody tr:hover,
table.data-table tbody tr:hover {
    background: var(--primary-soft);
}
html[data-theme="dark"] table.table tbody tr:hover,
html[data-theme="dark"] table.data-table tbody tr:hover {
    background: rgba(91, 138, 198, 0.08);
}
table.table tbody tr:last-child td,
table.data-table tbody tr:last-child td { border-bottom: 0; }
table.table .cell-primary,
table.data-table .cell-primary {
    font-weight: 600;
    color: var(--ink);
}
table.table .cell-primary:hover,
table.data-table .cell-primary:hover { color: var(--primary); }
table.table .cell-mono,
table.data-table .cell-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}
table.table .cell-num,
table.data-table .cell-num {
    font-family: var(--font-mono);
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    font-weight: 600;
}

/* 行内 actions 列 */
table.table .row-actions,
table.data-table .row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
}
table.table .row-actions .btn-sm,
table.data-table .row-actions .btn-sm {
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
}

/* ===== 9. 徽章（Flowbite 风格） ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 10px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: var(--radius-pill);
    border: 1px solid var(--rule);
    background: var(--paper-warm);
    color: var(--text-muted);
    line-height: 1;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}
.badge-pulse, .badge-accent { background: var(--accent-soft); color: var(--accent-deep); border-color: #F3C66B; }
.badge-moss { background: var(--moss-soft); color: var(--moss); border-color: #86D0A0; }
.badge-ember { background: var(--ember-soft); color: var(--ember); border-color: #F5A5A5; }
.badge-gold { background: var(--gold-soft); color: var(--gold); border-color: #E2B463; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: #A7C1EE; }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); border-color: #7ADBE8; }
.badge-ink, .badge-primary { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.badge-ink::before, .badge-primary::before { background: #FFFFFF; }

.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    height: 22px;
    font-size: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border: 1px solid var(--primary-border);
    border-radius: var(--radius-pill);
    transition: all var(--t-fast);
}
.tag-pill:hover {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

/* ===== 10. 表单 ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 24px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .col-1 { grid-column: span 1; }
.field { margin-bottom: 18px; }
.field-label {
    display: block;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.field-label .req { color: var(--ember); margin-left: 2px; }
.field-hint {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 6px;
    font-family: var(--font-mono);
}
.field-hint.err { color: var(--ember); }

.input, .textarea, .select {
    width: 100%;
    padding: 10px 14px;
    background: var(--paper-card);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-lg);
    font-size: 14px;
    color: var(--text);
    font-family: var(--font-sans);
    transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
}
.input:hover, .textarea:hover, .select:hover {
    border-color: var(--ink-mute);
}
.input:focus, .textarea:focus, .select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
html[data-theme="dark"] .input:focus,
html[data-theme="dark"] .textarea:focus,
html[data-theme="dark"] .select:focus {
    box-shadow: 0 0 0 3px rgba(91, 138, 198, 0.18);
}
.textarea {
    min-height: 96px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}
.input-mono {
    font-family: var(--font-mono);
    font-size: 13px;
}
.input-lg {
    padding: 12px 14px;
    font-size: 16px;
    font-weight: 500;
}

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .input {
    border-radius: var(--radius) 0 0 var(--radius);
}
.input-group .input-group-addon {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--paper-warm);
    border: 1px solid var(--rule-strong);
    border-left: 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}
.checkbox-row input[type="checkbox"],
.checkbox-row input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--rule-strong);
    border-radius: var(--radius-pill);
    transition: var(--t-base);
}
.switch .slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: var(--t-base);
    box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ===== 11. Flash 消息（Flowbite 风格） ===== */
.flash {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--rule);
    border-left: 4px solid var(--primary);
    background: var(--paper-card);
    border-radius: var(--radius-lg);
    font-size: 13px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    position: relative;
}
.flash-ok { border-left-color: var(--moss); background: var(--moss-soft); }
.flash-err { border-left-color: var(--ember); background: var(--ember-soft); }
.flash-warn { border-left-color: var(--gold); background: var(--gold-soft); }
.flash-info { border-left-color: var(--info); background: var(--info-soft); }
.flash .flash-title {
    font-weight: 700;
    font-family: var(--font-sans);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
    color: var(--ink);
}

/* ===== 12. 分页 ===== */
.pager {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}
.pager a, .pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-muted);
    transition: all var(--t-fast);
}
.pager a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}
.pager .cur {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-primary);
}
.pager .dots { border: 0; color: var(--text-faint); }

/* ===== 13. 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-faint);
}
.empty-state .glyph {
    font-size: 48px;
    color: var(--rule-strong);
    line-height: 1;
    margin-bottom: 14px;
    font-family: var(--font-mono);
}
.empty-state .title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.empty-state .desc {
    font-size: 13px;
    color: var(--text-faint);
    margin-bottom: 18px;
}

/* ===== 14. 工具栏 / 过滤栏 ===== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 14px 18px;
    background: var(--paper-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
}
.toolbar .search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.toolbar .search-box input {
    width: 100%;
    height: 34px;
    padding: 0 12px 0 34px;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-size: 13px;
    transition: all var(--t-fast);
}
.toolbar .search-box input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 42, 74, 0.10);
}
.toolbar .search-box svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-faint);
    pointer-events: none;
}
.toolbar .filter-tabs {
    display: flex;
    gap: 2px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 3px;
    background: var(--paper);
}
.toolbar .filter-tabs a {
    padding: 5px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all var(--t-fast);
}
.toolbar .filter-tabs a:hover { color: var(--ink); }
.toolbar .filter-tabs a.is-active {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: var(--shadow-primary);
}

/* ===== 15. 媒体网格 ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.media-card {
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    background: var(--paper-card);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--t-base);
    position: relative;
}
.media-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.media-card .thumb {
    aspect-ratio: 4 / 3;
    background: var(--paper-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.media-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--t-slow);
}
.media-card:hover .thumb img { transform: scale(1.05); }
.media-card .thumb .icon {
    font-family: var(--font-mono);
    font-size: 32px;
    color: var(--text-faint);
}
.media-card .body {
    padding: 8px 10px;
    font-size: 11px;
}
.media-card .body .name {
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}
.media-card .body .meta {
    font-family: var(--font-mono);
    color: var(--text-faint);
    font-size: 10px;
}

/* ===== 16. 编辑器区域 ===== */
.editor-frame {
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    background: var(--paper-card);
    overflow: hidden;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-warm);
    flex-wrap: wrap;
}
.editor-toolbar .btn-tool {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    transition: all var(--t-fast);
}
.editor-toolbar .btn-tool:hover {
    background: var(--paper-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}
.editor-toolbar .divider {
    width: 1px;
    height: 20px;
    background: var(--rule);
    margin: 0 4px;
}
.editor-textarea {
    width: 100%;
    min-height: 420px;
    padding: 20px 24px;
    border: 0;
    background: var(--paper-card);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    resize: vertical;
}
.editor-textarea:focus { outline: 0; }

/* ===== 17. 登录页 ===== */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-deep) 0%, var(--ink) 100%);
    position: relative;
    overflow: hidden;
    padding: 20px;
}
.login-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    mask-image: radial-gradient(circle at center, black 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 80%);
}
.login-shell::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(217, 119, 6, 0.18) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(60px);
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--paper-card);
    color: var(--ink);
    padding: 36px 32px 28px;
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.30);
    position: relative;
    z-index: 1;
}
.login-card .login-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.login-card .login-mark .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 20px;
    box-shadow: var(--shadow-accent);
}
.login-card .login-mark .brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.02em;
}
.login-card .login-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-faint);
    margin-bottom: 28px;
    display: block;
}
.login-card .login-foot {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    text-align: center;
}

/* ===== 18. 快捷操作 ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: var(--paper-card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: all var(--t-base);
    color: var(--text);
    position: relative;
    overflow: hidden;
}
.quick-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-soft) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--t-base);
    pointer-events: none;
}
.quick-action:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.quick-action:hover::before { opacity: 1; }
.quick-action .qa-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #FFFFFF;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
    transition: background var(--t-base);
}
.quick-action:hover .qa-icon {
    background: var(--accent);
    box-shadow: var(--shadow-accent);
}
.quick-action .qa-text { min-width: 0; flex: 1; position: relative; z-index: 1; }
.quick-action .qa-text .qa-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.quick-action .qa-text .qa-desc {
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    margin-top: 2px;
}

/* ===== 19. 活动时间线 ===== */
.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}
.timeline li {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule-soft);
    font-size: 13px;
    align-items: flex-start;
}
.timeline li:last-child { border-bottom: 0; }
.timeline .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(15, 42, 74, 0.12);
}
.timeline .dot.moss { background: var(--moss); box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15); }
.timeline .dot.ember { background: var(--ember); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.timeline .dot.gold { background: var(--gold); box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15); }
.timeline .dot.pulse, .timeline .dot.accent { background: var(--accent); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15); }
.timeline .dot.info { background: var(--info); box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15); }
.timeline .time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-faint);
    margin-left: auto;
    flex-shrink: 0;
}

/* ===== 20. 响应式 ===== */
@media (max-width: 1280px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .admin-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "main";
    }
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: var(--sidebar-w);
        transform: translateX(-100%);
        transition: transform var(--t-base);
        z-index: 100;
        box-shadow: var(--shadow-xl);
    }
    .admin-sidebar.is-open { transform: translateX(0); }
    .topbar-toggle { display: flex; }
    .topbar-search { display: none; }
    .topbar-user .uname, .topbar-user .logout { display: none; }
}
@media (max-width: 768px) {
    .admin-main { padding: 18px 14px 56px; }
    .page-head {
        flex-direction: column;
        align-items: stretch;
    }
    .page-head h1 { font-size: 22px; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .form-grid { grid-template-columns: 1fr; }
    .card-grid.cols-2, .card-grid.cols-3, .card-grid.cols-4 {
        grid-template-columns: 1fr;
    }
    .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 14px 16px; }
    .stat .num { font-size: 24px; }
    .toolbar { padding: 10px 12px; }
    .toolbar .search-box { min-width: 100%; }
    .card { padding: 16px 18px; }
    .topbar-actions { gap: 8px; }
    .topbar-user { padding-left: 8px; }

    /* 顶栏面包屑在窄屏截断，避免撑出横向滚动 */
    .topbar-crumb { min-width: 0; }
    .topbar-crumb .crumb-current {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 38vw;
    }

    /* 表格容器：移动端默认横向滚动，避免内容被挤压 */
    .table-wrap { border-radius: var(--radius-lg); }
    .table-wrap.is-scroll,
    .card > .overflow-x-auto { -webkit-overflow-scrolling: touch; }

    /* 操作按钮列在窄屏允许换行，不强制单行 */
    table.table td .btn-sm,
    table.data-table td .btn-sm,
    table.table td form, table.data-table td form { display: inline-block; margin: 2px 0; }
}
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr; }
    /* 超窄屏侧栏抽屉收窄，提升操作区可见性 */
    .admin-sidebar { width: min(var(--sidebar-w), 86vw); }
    .admin-main { padding: 16px 12px 56px; }
    /* iOS 安全区适配 */
    .admin-main { padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px)); }
    .page-head .actions .btn { flex: 1 1 100%; justify-content: center; }
}

/* ===== 21. 工具类（与 Tailwind 互补） ===== */
.text-muted { color: var(--text-muted) !important; }
.text-faint { color: var(--text-faint) !important; }
.text-pulse, .text-accent { color: var(--accent) !important; }
.text-primary { color: var(--primary) !important; }
.text-mono { font-family: var(--font-mono) !important; }
.text-display { font-family: var(--font-display) !important; }
.text-italic { font-style: italic; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.06em; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-0 { padding: 0; } .p-16 { padding: 16px; } .p-20 { padding: 20px; } .p-24 { padding: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-pill); }
.shadow { box-shadow: var(--shadow-sm); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* scrim for mobile sidebar */
.scrim {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base);
}
.scrim.is-visible { opacity: 1; pointer-events: auto; }

/* ===== 22. 加载指示器 ===== */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}
.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.4;
    animation: loading-pulse 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.30s; }
@keyframes loading-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

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

/* ===== 23. 备份/维护页扩展类 ===== */
.hint {
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--font-sans);
    font-weight: 400;
}
.card-body {
    /* 卡片内容容器：默认无额外 padding（.card 已有） */
    /* 仅作为语义化包装，便于扩展 */
}
.card-body .form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.card-body .form-row .field { flex: 1; min-width: 220px; margin-bottom: 0; }

table.data-table .cell-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}
table.data-table .cell-actions .btn,
table.data-table .cell-actions form {
    margin-left: 4px;
}

/* ===== 24. 数据库维护报告（修复 / 缓存更新） ===== */
.maint-report {
    margin: 0;
}
.maint-report h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}
.maint-report h3::before {
    content: '✓';
    display: inline-flex;
    width: 22px; height: 22px;
    background: var(--moss);
    color: #FFFFFF;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.maint-report.is-error h3::before {
    content: '!';
    background: var(--ember);
}
.maint-report > p {
    margin: 6px 0 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.maint-report > p b { color: var(--ink); font-weight: 600; }
.maint-report table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
}
.maint-report th,
.maint-report td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--rule-soft);
}
.maint-report th {
    background: var(--paper-warm);
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.06em;
}
.maint-report td.ok-yes { color: var(--moss); font-weight: 600; }
.maint-report td.ok-no { color: var(--ember); font-weight: 600; }
.maint-report .foot-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--font-mono);
    line-height: 1.6;
}

/* ===== 25. 表单布局扩展 ===== */
.form-vertical {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.form-vertical .field { margin-bottom: 18px; }
.form-vertical .form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--rule-soft);
    flex-wrap: wrap;
}
.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.form-actions .btn + .btn { margin-left: 0; }

/* ===== 26. 表单与表格辅助类（模块视图兼容层） ===== */

/* 让 .form-vertical 内的裸 label 自动获得 field-label 样式 */
.form-vertical label:not(.checkbox-row):not(.field-label) {
    display: block;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-vertical label .req,
.form-vertical .req {
    color: var(--ember);
    margin-left: 2px;
}
/* 兼容视图中 <p class="hint"> 的写法 */
.form-vertical .hint,
.hint {
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 6px;
    font-family: var(--font-sans);
    line-height: 1.5;
}
.form-vertical .field .hint { margin-bottom: 0; }

/* 通用 input/select/textarea 在 .form-vertical 内的样式（未加 .input 类时） */
.form-vertical input[type="text"],
.form-vertical input[type="password"],
.form-vertical input[type="email"],
.form-vertical input[type="number"],
.form-vertical input[type="search"],
.form-vertical input[type="url"],
.form-vertical select,
.form-vertical textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--paper-card);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font-sans);
    color: var(--ink);
    box-sizing: border-box;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-vertical input:focus,
.form-vertical select:focus,
.form-vertical textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-vertical textarea {
    min-height: 120px;
    vertical-align: top;
    font-family: var(--font-mono);
    line-height: 1.6;
}
.form-vertical .checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-vertical .checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* ===== 27. 按钮语义别名 ===== */
.btn-success {
    background: var(--moss);
    color: #FFFFFF;
    border-color: var(--moss);
}
.btn-success:hover {
    background: #0F5E2E;
    border-color: #0F5E2E;
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.3);
}
.btn-secondary {
    background: var(--paper-warm);
    color: var(--ink-soft);
    border-color: var(--rule-strong);
}
.btn-secondary:hover {
    background: var(--rule-soft);
    color: var(--ink);
}

/* ===== 28. Badge 语义别名 ===== */
.badge-success { background: var(--moss-soft); color: var(--moss); border-color: var(--moss); }
.badge-danger  { background: var(--ember-soft); color: var(--ember); border-color: var(--ember); }

/* ===== 29. 表格单元格辅助类 ===== */
.table .cell-strong { font-weight: 600; color: var(--ink); }
.table .cell-mute   { color: var(--text-muted); font-size: 12px; }
.table .cell-mono   { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.table .cell-actions {
    white-space: nowrap;
    text-align: right;
}
.table .cell-actions form { display: inline; margin: 0; }
.table .cell-actions .btn + .btn,
.table .cell-actions .btn + form,
.table .cell-actions form + .btn,
.table .cell-actions form + form { margin-left: 4px; }
.table th.col-actions { text-align: right; }

/* ===== 30. 空状态别名（兼容 .empty-icon/.empty-title/.empty-desc 写法） ===== */
.empty-state .empty-icon {
    font-size: 48px;
    color: var(--rule-strong);
    line-height: 1;
    margin-bottom: 14px;
    font-family: var(--font-mono);
}
.empty-state .empty-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.empty-state .empty-desc {
    font-size: 13px;
    color: var(--text-faint);
    margin-bottom: 18px;
}

/* ===== 31. 元信息网格（详情页） ===== */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px 24px;
    font-size: 13px;
}
.meta-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule-soft);
}
.meta-label {
    font-size: 11px;
    color: var(--text-faint);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.meta-value {
    color: var(--ink-soft);
    font-size: 13px;
    word-break: break-all;
}

/* ===== 32. Prose 内容（渲染预览） ===== */
.prose-content {
    line-height: 1.75;
    color: var(--ink-soft);
    font-size: 14px;
}
.prose-content h1 { font-size: 22px; font-weight: 700; color: var(--ink); margin: 20px 0 12px; }
.prose-content h2 { font-size: 18px; font-weight: 700; color: var(--ink); margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.prose-content h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin: 14px 0 8px; }
.prose-content p { margin: 10px 0; }
.prose-content ul, .prose-content ol { margin: 10px 0; padding-left: 24px; }
.prose-content li { margin: 4px 0; }
.prose-content pre {
    background: var(--primary-deep);
    color: #E2E8F0;
    padding: 14px 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    margin: 12px 0;
}
.prose-content code {
    background: var(--paper-warm);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-deep);
}
.prose-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.prose-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 4px 14px;
    margin: 12px 0;
    color: var(--text-muted);
    background: var(--paper-warm);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.prose-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.prose-content a { color: var(--primary); text-decoration: underline; }
.prose-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}
.prose-content table th,
.prose-content table td {
    border: 1px solid var(--rule);
    padding: 8px 12px;
    text-align: left;
}
.prose-content table th { background: var(--paper-warm); font-weight: 600; }

/* ===== 33. AI 配置预设文档 ===== */
.preset-doc {
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--paper-warm);
    border-left: 2px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ===== 34. 筛选栏（列表页顶部） ===== */
/* 独立于 .form-vertical，避免 column 方向与 width:100% 的干扰 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 14px;
}
.filter-bar .filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}
.filter-bar .filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    letter-spacing: 0.01em;
}
.filter-bar .input,
.filter-bar .select {
    width: auto;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--paper-card);
    color: var(--ink);
    box-sizing: border-box;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.filter-bar .input:focus,
.filter-bar .select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
/* 第一个字段（关键词）给稍宽一些 */
.filter-bar .filter-field:first-child .input { min-width: 200px; }

/* 复选框组：横向排列，label 与文字同行 */
.filter-bar .filter-checkboxes {
    flex-direction: row;
    align-items: center;
    gap: 14px;
}
.filter-bar .filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}
.filter-bar .filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

/* 操作按钮组 */
.filter-bar .filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto; /* 推到最右 */
}
@media (max-width: 720px) {
    .filter-bar .filter-actions { margin-left: 0; }
}

