/* ============================================================================
   璀璨网络验证 · 代理后台 —— 唯一样式文件
   ----------------------------------------------------------------------------
   纯手写 CSS：无预处理器、无外部字体、无 CDN、无任何样式导入指令。
   设计令牌取自原站 assets/style.css（浅色主题），组件按本项目 DOM 契约重写。
   区块顺序：
     01 设计令牌        02 复位与全局      03 排版与工具类    04 布局骨架
     05 侧边栏          06 顶栏            07 页头            08 卡片
     09 按钮            10 徽章            11 提示框          12 表单
     13 筛选与批量栏    14 表格            15 视图切换        16 分页
     17 首页工作台      18 弹窗            19 Toast           20 设备预览浮层
     21 公告            22 登录与滑块验证  23 页面专有块      24 响应式
     25 辅助与无障碍
   ============================================================================ */


/* ============================================================================
   01 设计令牌
   ============================================================================ */
:root {
    /* 主色 */
    --color-primary: #285ce5;
    --color-primary-hover: #194acf;
    --color-primary-light: #e8efff;

    /* 辅助色 / 状态色 */
    --color-secondary: #637188;
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;
    --color-error: #ef4444;
    --color-error-hover: #dc2626;
    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;

    /* 背景 / 表面 */
    --color-bg: #f5f7fb;
    --color-surface: #ffffff;
    --color-surface-alt: #f4f7fc;

    /* 边框 */
    --color-border: #dce3ee;
    --color-border-strong: #c9d3e3;

    /* 文字 */
    --color-text-primary: #172338;
    --color-text-secondary: #637188;
    --color-text-tertiary: #8b98ab;
    --color-text-on-primary: #ffffff;

    /* 字号 */
    --text-xs: 12px;
    --text-sm: 14px;
    --text-base: 16px;
    --text-lg: 20px;
    --text-xl: 24px;
    --text-2xl: 32px;

    /* 字重 / 行高 */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --lh-body: 1.5;
    --lh-heading: 1.25;

    /* 间距 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-9: 36px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* 圆角 */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-pill: 100px;

    /* 阴影 */
    --shadow-1: 0 3px 14px rgba(24, 56, 94, 0.04);
    --shadow-2: 0 12px 32px rgba(36, 53, 80, 0.08);
    --shadow-3: 0 4px 18px rgba(36, 53, 80, 0.055);

    /* 布局尺寸 */
    --sidebar-width: 240px;
    --sidebar-width-drawer: 264px;
    --topbar-height: 64px;
    --topbar-height-mobile: 52px;
    --focus-ring: 0 0 0 3px rgba(40, 92, 229, 0.14);
}


/* ============================================================================
   02 复位与全局
   ============================================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: var(--text-sm);
    font-weight: var(--fw-regular);
    line-height: var(--lh-body);
    color: var(--color-text-primary);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

body::-webkit-scrollbar {
    width: 6px;
}

body::-webkit-scrollbar-track {
    background: transparent;
}

body::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 3px;
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-tertiary);
}

/* 弹窗打开时锁滚动（app.js：body.modal-active） */
body.modal-open,
body.modal-active {
    overflow: hidden;
}

/* 移动端抽屉打开时锁滚动 */
body.sidebar-open {
    overflow: hidden;
    touch-action: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: var(--fw-semibold);
    line-height: var(--lh-heading);
    color: var(--color-text-primary);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

p {
    line-height: var(--lh-body);
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img,
svg,
video {
    max-width: 100%;
    vertical-align: middle;
}

img {
    border-style: none;
}

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

table {
    border-collapse: collapse;
    border-spacing: 0;
}

ul,
ol {
    list-style: none;
}

[hidden] {
    display: none !important;
}

::selection {
    background: rgba(40, 92, 229, 0.16);
}


/* ============================================================================
   03 排版与工具类
   ============================================================================ */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-primary { color: var(--color-text-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-danger { color: var(--color-error); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-semibold { font-weight: var(--fw-semibold); }
.nowrap { white-space: nowrap; }
.word-break { word-break: break-all; }

/* 通用布局工具 */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; min-width: 0; }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.hidden { display: none; }
.mw-100 { max-width: 100%; }

/* 单行省略 */
.ellipsis {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state-pad {
    text-align: center;
    padding: var(--space-10);
    color: var(--color-text-secondary);
}

/* 图标基础 */
.icon {
    width: 16px;
    height: 16px;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.icon-lg {
    width: 20px;
    height: 20px;
}

/* 代码块 */
.code-block {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-xs);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    margin: 0;
}

.generated-cards-textarea {
    width: 100%;
    min-height: 220px;
    height: 220px;
    resize: vertical;
    line-height: 1.6;
}

.ai-prompt-text {
    font-size: 13px;
    line-height: 1.6;
}

.kami-full-width { width: 100%; }
.kami-input { width: 100%; }
.table-empty { text-align: center; color: var(--color-text-secondary); padding: var(--space-8) var(--space-4) !important; }


/* ============================================================================
   04 布局骨架
   ============================================================================ */
.layout {
    display: flex;
    min-height: 100vh;
    min-width: 0;
}

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

.content {
    flex: 1;
    padding: var(--space-8);
    min-width: 0;
}


/* ============================================================================
   05 侧边栏
   ============================================================================ */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.86);
    border-right: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 8px 0 28px rgba(36, 53, 80, 0.04);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
}

.sidebar-brand {
    height: var(--topbar-height);
    padding: 0 var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    color: var(--color-text-primary);
    flex: 0 0 auto;
    white-space: nowrap;
}

.sidebar-brand > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 auto;
    background: var(--color-surface-alt);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: 2px 10px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: #f8faff;
    color: var(--color-primary);
    text-decoration: none;
}

.nav-item.active {
    background: #e8efff;
    color: #194acf;
    font-weight: var(--fw-semibold);
    box-shadow: inset 0 0 0 1px #afc4f9, 0 4px 12px rgba(40, 92, 229, 0.09);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--color-primary);
}

.nav-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.nav-icon .icon {
    width: 17px;
    height: 17px;
    color: currentColor;
    stroke-width: 1.6;
}

.nav-item.active .nav-icon {
    box-shadow: inset 0 0 0 1px rgba(40, 92, 229, 0.16);
}

/* 图标配色分组 */
.nav-icon-cards { color: #087f85; background: #eaf8f7; }
.nav-icon-agents,
.nav-icon-materials { color: #8053b5; background: #f3edfc; }
.nav-icon-logs { color: #ab701c; background: #fff6e7; }
/* 应用 / 设置图标使用默认蓝色系（显式声明，便于单独覆盖） */
.nav-icon-apps,
.nav-icon-settings { color: var(--color-primary); background: var(--color-primary-light); }

/* 移动端遮罩（默认隐藏） */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

.sidebar-overlay.show,
.sidebar-overlay.sidebar-overlay-show {
    display: block;
}


/* ============================================================================
   06 顶栏
   ============================================================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    flex: 0 0 auto;
    height: var(--topbar-height);
    padding: 0 var(--space-8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(220, 227, 238, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    flex: 1;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    min-width: 0;
    flex: 0 0 auto;
}

.topbar-user .user-name {
    color: var(--color-text-primary);
}

.topbar-user form {
    display: inline-flex;
    margin: 0;
}

/* 公告滚动条 */
.topbar-notice {
    flex: 1 1 auto;
    min-width: 260px;
    max-width: none;
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
    padding: 0 var(--space-3);
    cursor: pointer;
    overflow: hidden;
    font: inherit;
    text-align: left;
}

.topbar-notice span {
    color: var(--color-primary);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    flex: 0 0 auto;
}

.topbar-notice marquee {
    font-size: var(--text-sm);
    min-width: 0;
}

.topbar-notice:hover {
    border-color: var(--color-border-strong);
}

/* 公告铃铛按钮 */
.notice-icon-btn {
    position: relative;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
}

.notice-icon-btn .icon {
    width: 18px;
    height: 18px;
}

/* 移动端汉堡按钮（桌面隐藏） */
.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--color-text-primary);
    border-radius: var(--radius-sm);
}

.menu-toggle:hover {
    background: var(--color-surface-alt);
}

.menu-toggle .icon {
    width: 24px;
    height: 24px;
}


/* ============================================================================
   07 页头
   ============================================================================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
    min-width: 0;
}

.page-title {
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-heading);
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin-top: var(--space-2);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.7;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}


/* ============================================================================
   08 卡片
   ============================================================================ */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow-1);
    overflow-x: auto;
    min-width: 0;
}

.card + .card {
    margin-top: var(--space-6);
}

.card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-heading);
    min-width: 0;
}

.card-header h3 {
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
}

.card-tools {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    min-width: 0;
}

.card-body {
    padding: var(--space-6);
    min-width: 0;
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
    background: var(--color-surface);
}

.card-body-flush {
    padding: 0;
}

/* 列表卡片（含 list-view）增强 */
.card:has(> .card-body.list-view) {
    border-color: #ffffff;
    box-shadow: 0 8px 28px rgba(36, 53, 80, 0.06);
}

.card:has(> .card-body.list-view) > .card-header {
    gap: var(--space-3);
    background: radial-gradient(ellipse at 88% 0, #eaf1ff 0, transparent 56%), linear-gradient(180deg, #ffffff, #f9fbff);
}

.card:has(> .card-body.list-view) > .card-header .card-title {
    font-size: var(--text-lg);
    letter-spacing: -0.02em;
}


/* ============================================================================
   09 按钮
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s, color 0.2s;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    max-width: 100%;
}

.btn:hover {
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(40, 92, 229, 0.22);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: #ffffff;
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

.btn-success {
    background: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
}

.btn-success:hover {
    background: var(--color-success-hover);
    border-color: var(--color-success-hover);
    color: #ffffff;
}

.btn-warning {
    background: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
}

.btn-warning:hover {
    background: var(--color-warning-hover);
    border-color: var(--color-warning-hover);
    color: #ffffff;
}

.btn-danger {
    background: var(--color-error);
    color: #ffffff;
    border-color: var(--color-error);
}

.btn-danger:hover {
    background: var(--color-error-hover);
    border-color: var(--color-error-hover);
    color: #ffffff;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:disabled,
.btn.disabled {
    background: var(--color-border);
    color: var(--color-text-tertiary);
    cursor: not-allowed;
    border-color: var(--color-border);
    box-shadow: none;
}

.btn-group {
    display: inline-flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* 行内操作按钮组 */
.list-action-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: nowrap;
    min-width: 0;
}

.list-action-row .filter-form {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
}

.key-actions-inline {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.material-action-group {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}


/* ============================================================================
   10 徽章
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    line-height: 1.4;
    border-radius: 999px;
    white-space: nowrap;
}

.badge-success { background: #ecfdf5; color: #065f46; }
.badge-error { background: #fef2f2; color: #991b1b; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-secondary { background: var(--color-surface-alt); color: var(--color-text-secondary); }
.badge-info { background: var(--color-primary-light); color: #194acf; }
.badge-primary { background: var(--color-primary); color: #ffffff; }

.card-status-cell .badge {
    white-space: nowrap;
}


/* ============================================================================
   11 提示框
   ============================================================================ */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: 1.7;
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
    overflow-wrap: anywhere;
}

.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--color-primary-light); color: #194acf; border-color: #c5d4f8; }


/* ============================================================================
   12 表单
   ============================================================================ */
.form-group {
    margin-bottom: var(--space-4);
    min-width: 0;
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--color-text-primary);
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.form-label-row .form-label {
    margin-bottom: 0;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--color-text-primary);
    min-height: 42px;
    transition: border-color 0.15s, box-shadow 0.15s;
    max-width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
.form-input[readonly],
.form-textarea[readonly] {
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-tertiary);
}

.form-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23285ce5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 42px;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    line-height: 1.7;
}

.form-input[type="color"] {
    height: 42px;
    padding: 4px 6px;
    cursor: pointer;
    background: #ffffff;
}

.form-input[type="number"] {
    -moz-appearance: textfield;
}

.form-hint {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    line-height: 1.6;
}

.form-error {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-error);
    line-height: 1.6;
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    min-width: 0;
}

.form-grid-span {
    grid-column: 1 / -1;
}

.form-narrow {
    max-width: 420px;
    margin: 0 auto;
}

.form-row {
    display: flex;
    gap: var(--space-4);
    min-width: 0;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    user-select: none;
}

.form-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-checkbox-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: #ffffff;
}

.form-checkbox input[type="checkbox"]:checked + .form-checkbox-check {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.form-checkbox input[type="checkbox"]:checked + .form-checkbox-check::after {
    content: '\2713';
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

.form-checkbox input[type="checkbox"]:focus-visible + .form-checkbox-check {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.check-line {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
    color: var(--color-text-primary);
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-4);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 36px;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    cursor: pointer;
}

.inline-checks {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.inline-checks .check-line { margin-top: 0; }

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

input[type="file"] {
    font-size: var(--text-sm);
}


/* ============================================================================
   13 筛选表单与批量栏
   ============================================================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-3);
}

.toolbar h2 { font-size: var(--text-lg); }

.filter-form {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    min-width: 0;
}

.filter-form .form-input,
.filter-form .form-select,
.filter-form .form-textarea {
    width: auto;
    min-width: 160px;
    height: 42px;
    min-height: 42px;
    font-size: var(--text-sm);
}

.filter-form .form-textarea {
    min-height: 42px;
    height: auto;
}

.filter-form .btn {
    height: 42px;
    padding: 0 var(--space-4);
    font-size: var(--text-sm);
}

.filter-form .form-checkbox {
    min-height: 42px;
}

/* 批量操作栏 */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-3) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    min-width: 0;
}

.bulk-bar .form-select {
    width: auto;
    min-width: 160px;
    height: 42px;
    min-height: 42px;
}

.bulk-bar .btn {
    height: 36px;
}

/* 勾选后高亮 */
.bulk-bar.bulk-bar-active {
    background: var(--color-primary-light);
    border-bottom-color: #c5d4f8;
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.bulk-bar.bulk-bar-active [data-selected-count] {
    color: var(--color-primary);
    font-weight: var(--fw-semibold);
}

/* 卡片视图下的批量控件 */
.card-list-bulk {
    margin: 0;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}

.card-list-bulk .form-select {
    min-width: 128px;
}

.card-list-bulk .btn {
    height: 42px;
}

.card-bulk-module {
    display: none;
}

.card-view .card-bulk-module,
.view-card .card-bulk-module {
    display: block;
}

.card-device-heading {
    display: block;
    margin-bottom: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.log-mobile-select-label {
    display: none;
}


/* ============================================================================
   14 表格
   ============================================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--color-text-primary);
}

.table:has(colgroup) {
    table-layout: fixed;
    width: 100%;
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-sm);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    min-width: 0;
}

.table th {
    font-weight: var(--fw-semibold);
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    white-space: nowrap;
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
}

.table tbody tr:hover td {
    background: transparent;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格滚动容器 */
.view-list-table-scroll {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
}

/* 列表视图（.list-view / .view-list） */
.list-view .view-list-table-scroll {
    overflow-x: hidden;
}

.list-view .view-list-table-scroll:has(col.col-key) {
    overflow-x: auto;
}

.list-view .table:has(col.col-key) {
    min-width: 1180px;
}

.list-view .table:has(col.col-key) th,
.list-view .table:has(col.col-key) td {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.list-view .table thead th {
    background: #f4f7fd;
    color: #536580;
    font-weight: var(--fw-semibold);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.list-view .table thead th:first-child { border-top-left-radius: var(--radius-sm); }
.list-view .table thead th:last-child { border-top-right-radius: var(--radius-sm); }

.list-view .table tbody tr {
    transition: background-color 0.18s ease;
}

.list-view .table tbody tr:nth-child(even) {
    background: #fafcff;
}

.list-view .table tbody tr:hover {
    background: #eff4ff;
}

.list-view .table tbody tr:hover td {
    background: transparent;
}

.list-view .table tbody td {
    border-bottom-color: #e9eef6;
}

.list-view > .pagination {
    margin-top: var(--space-4);
    padding: var(--space-4) 0 0;
    border-top: 1px solid #e9eef6;
}

.list-view > .filter-form,
.list-view > .list-action-row {
    padding: var(--space-3);
    border: 1px solid #e9eef6;
    border-radius: var(--radius-md);
    background: #f8faff;
}

.list-view > .filter-form.mb-4,
.list-view > .list-action-row.mb-4 {
    margin-bottom: var(--space-5);
}

/* 列宽令牌 */
.table col.col-check { width: 40px; }
.table col.col-id { width: 56px; }
.table col.col-key { width: 132px; }
.table col.col-name { width: 9%; }
.table col.col-type { width: 72px; }
.table col.col-device { width: 11%; }
.table col.col-ip { width: 108px; }
.table col.col-status { width: 92px; }
.table col.col-online { width: 116px; }
.table col.col-time { width: 84px; }
.table col.col-actions { width: 156px; }

/* 紧凑列表（含 key 列）的列宽 */
.list-view .table:has(col.col-key) col.col-check { width: 36px; }
.list-view .table:has(col.col-key) col.col-id { width: 48px; }
.list-view .table:has(col.col-key) col.col-key { width: 116px; }
.list-view .table:has(col.col-key) col.col-name { width: 80px; }
.list-view .table:has(col.col-key) col.col-type { width: 72px; }
.list-view .table:has(col.col-key) col.col-device { width: 104px; }
.list-view .table:has(col.col-key) col.col-ip { width: 96px; }
.list-view .table:has(col.col-key) col.col-online { width: 108px; }
.list-view .table:has(col.col-key) col.col-time { width: 72px; }
.list-view .table:has(col.col-key) col.col-status { width: 88px; }
.list-view .table:has(col.col-key) col.col-actions { width: 132px; }

/* 单元格语义类 */
.card-select-cell {
    width: 40px;
    text-align: center;
}

.card-select-cell input[type="checkbox"] {
    margin: 0 auto;
}

.cell-content {
    display: block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-sm { max-width: 150px; }
.cell-wide { max-width: 280px; }

.key-cell,
.secret-cell {
    max-width: none;
    word-break: normal;
}

.key-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-width: 0;
}

.key-inline span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.key-inline .btn { flex-shrink: 0; }

.key-modal-inline {
    grid-template-columns: 1fr auto auto;
    align-items: start;
}

.key-modal-inline span {
    white-space: normal;
    word-break: break-all;
    overflow: visible;
    text-overflow: clip;
}

.secret-cell .key-inline {
    grid-template-columns: minmax(80px, 1fr) auto;
    min-width: 300px;
}

.card-no-cell .key-inline { min-width: 0; }

.card-copy-text {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--color-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.card-copy-text:hover {
    text-decoration: underline;
}

.card-app-cell,
.card-status-cell,
.card-agent-cell,
.device-id-cell {
    min-width: 0;
    width: auto;
    max-width: none;
}

.card-app-name {
    display: block;
    width: auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-agent-name,
.card-agent-parent {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
    text-align: left;
}

.card-agent-parent {
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
}

.card-status-cell {
    white-space: nowrap;
}

.device-id-text {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    line-height: 1.4;
}

button.device-id-text {
    color: var(--color-primary);
    cursor: pointer;
}

.view-list .device-id-cell {
    max-width: 220px;
}

[data-device-cell] {
    position: relative;
}

/* 时间显示：紧凑 / 完整二选一 */
.date-compact {
    display: inline-block;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.date-full {
    display: none;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

td:has(.date-compact) {
    position: relative;
}

.login-time-cell,
.log-time-cell {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-secondary);
}

.log-card-row td {
    vertical-align: middle;
}

.app-name-cell {
    width: 160px;
    max-width: 160px;
}

.app-name-cell > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-card-count {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.app-run-control {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 160px;
}

.app-run-control .btn {
    font-size: var(--text-xs);
    padding: 3px 10px;
    height: auto;
}

/* 素材单元格 */
.material-name-cell { max-width: 240px; }
.material-remark-cell { max-width: 160px; }
.material-remark-empty { max-width: 24px; color: var(--color-text-tertiary); }

.material-readonly-note {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.material-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.material-page-header,
.agent-material-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.material-page-card,
.agent-material-page-card {
    min-width: 0;
}

/* 账号文本省略 */
.account-table-ellipsis {
    display: block;
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-nav-ellipsis {
    display: inline-block;
    min-width: 0;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.account-text-wrap {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.account-select {
    min-width: 0;
    max-width: 240px;
}

.agent-remark-cell {
    max-width: 120px;
    cursor: pointer;
}

.capture-summary-cell {
    width: 200px;
    max-width: 200px;
}

.capture-device-id-cell {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.capture-blacklist-actions,
.log-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.log-bulk-control {
    display: inline-flex;
    align-items: center;
}

.date-stack {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
    white-space: nowrap;
}

.date-stack span { font-size: var(--text-sm); color: var(--color-text-primary); }
.date-stack small { font-size: var(--text-xs); color: var(--color-text-tertiary); }


/* ============================================================================
   15 视图切换（列表 / 卡片）
   ============================================================================ */
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-sm);
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    font-size: var(--text-xs);
    transition: all 0.15s;
}

.view-toggle-btn:hover {
    color: var(--color-text-primary);
}

.view-toggle-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-1);
    font-weight: var(--fw-semibold);
}

.view-toggle-btn .icon {
    width: 16px;
    height: 16px;
}

/* -------------------- 卡片视图：table 结构转卡片网格 -------------------- */
.card-view .view-list-table-scroll,
.view-card .view-list-table-scroll {
    overflow: visible;
}

.card-view .view-list-table-scroll table,
.view-card .view-list-table-scroll table {
    display: block;
    width: 100%;
    table-layout: auto;
    overflow: visible;
}

.card-view .view-list-table-scroll table thead,
.card-view thead,
.view-card .view-list-table-scroll table thead,
.view-card thead {
    display: none;
}

.card-view .view-list-table-scroll table tbody,
.view-card .view-list-table-scroll table tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-3);
    width: 100%;
}

.card-view .view-list-table-scroll table tbody tr,
.view-card .view-list-table-scroll table tbody tr {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: linear-gradient(180deg, #ffffff, #fcfdff);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    box-shadow: var(--shadow-3);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.card-view .view-list-table-scroll table tbody tr:hover,
.view-card .view-list-table-scroll table tbody tr:hover {
    background: linear-gradient(180deg, #ffffff, #fcfdff);
    border-color: #c5d4f8;
    box-shadow: 0 8px 24px rgba(36, 53, 80, 0.09);
}

.card-view .view-list-table-scroll table tbody tr:nth-child(even),
.view-card .view-list-table-scroll table tbody tr:nth-child(even) {
    background: linear-gradient(180deg, #ffffff, #fcfdff);
}

.card-view .view-list-table-scroll table tbody td,
.view-card .view-list-table-scroll table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    width: auto;
    max-width: none;
    min-width: 0;
    padding: var(--space-2) 0;
    border-bottom: 1px dashed var(--color-surface-alt);
    text-align: left;
}

.card-view .view-list-table-scroll table tbody td:last-child,
.view-card .view-list-table-scroll table tbody td:last-child {
    border-bottom: none;
}

/* data-label 前缀：卡片视图的表头 */
.card-view .view-list-table-scroll table tbody td::before,
.view-card .view-list-table-scroll table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    min-width: 76px;
    max-width: 46%;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    line-height: 1.6;
    word-break: break-word;
}

.card-view .view-list-table-scroll table tbody td[data-label=""]::before,
.view-card .view-list-table-scroll table tbody td[data-label=""]::before {
    display: none;
}

.card-view .card-select-cell,
.view-card .card-select-cell {
    width: auto;
    text-align: left;
    justify-content: flex-start;
}

.card-view .view-list-table-scroll table tbody td > .flex,
.card-view .view-list-table-scroll table tbody td > .btn,
.card-view .view-list-table-scroll table tbody td > .badge,
.card-view .view-list-table-scroll table tbody td > .key-inline,
.card-view .view-list-table-scroll table tbody td > .device-id-text,
.card-view .view-list-table-scroll table tbody td > .card-copy-text,
.view-card .view-list-table-scroll table tbody td > .flex,
.view-card .view-list-table-scroll table tbody td > .btn,
.view-card .view-list-table-scroll table tbody td > .badge,
.view-card .view-list-table-scroll table tbody td > .key-inline,
.view-card .view-list-table-scroll table tbody td > .device-id-text,
.view-card .view-list-table-scroll table tbody td > .card-copy-text {
    min-width: 0;
    max-width: 100%;
}

.card-view .date-compact,
.view-card .date-compact {
    display: none;
}

.card-view .date-full,
.view-card .date-full {
    display: inline;
    white-space: nowrap;
}

.card-view .device-id-cell .device-id-text,
.view-card .device-id-cell .device-id-text {
    white-space: normal;
    word-break: break-all;
    overflow-wrap: anywhere;
    text-overflow: clip;
}

.card-view .view-list-table-scroll table tbody td[data-label="操作"] .flex,
.view-card .view-list-table-scroll table tbody td[data-label="操作"] .flex {
    flex-wrap: wrap;
}

.card-view .card-no-cell .key-inline,
.view-card .card-no-cell .key-inline {
    min-width: 0;
}

.card-view .cell-content,
.view-card .cell-content {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}


/* ============================================================================
   16 分页
   ============================================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    flex-wrap: wrap;
}

.pagination a,
.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-secondary);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.86);
    transition: all 0.15s ease-in-out;
    cursor: pointer;
}

.pagination a:hover,
.pagination .page-link:hover {
    background: var(--color-primary-light);
    border-color: #b9caf3;
    color: var(--color-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.pagination .page-link.active,
.pagination a.active,
.pagination .current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 5px 12px rgba(40, 92, 229, 0.2);
}

.pagination .page-link.disabled,
.pagination .disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--color-surface-alt);
    transform: none;
    box-shadow: none;
}

.pagination .page-link.disabled:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    transform: none;
}

.pagination-pages {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.pagination-ellipsis {
    color: var(--color-text-secondary);
    padding: 0 var(--space-1);
}

.pagination-size {
    display: inline-flex;
    align-items: center;
}

.pagination-size .form-select {
    width: auto;
    min-width: 118px;
    height: 36px;
    min-height: 36px;
    padding-top: 0;
    padding-bottom: 0;
    border-radius: 999px;
    background-color: #ffffff;
}

.pagination-size .filter-form {
    flex-wrap: nowrap;
}

.pagination a.btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.pagination a.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #ffffff;
}


/* ============================================================================
   17 首页工作台（dashboard）
   ============================================================================ */
.home-workspace {
    max-width: 1440px;
    min-width: 0;
    margin: 0 auto;
    color: var(--color-text-primary);
}

.home-workspace h2 {
    font-size: 18px;
    color: var(--color-text-primary);
}

.home-workspace a:hover {
    text-decoration: none;
}

.home-workspace a:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 4px;
}

/* -------------------- Hero -------------------- */
.home-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-8);
    padding: 34px 38px;
    border: 1px solid #ffffff;
    border-radius: 22px;
    background:
        radial-gradient(ellipse at 88% 20%, #dce8ff 0, transparent 46%),
        radial-gradient(ellipse at 42% 80%, #eee9ff 0, transparent 42%),
        linear-gradient(180deg, #f9fafc, #eef3fb);
    box-shadow: var(--shadow-1);
    color: var(--color-text-primary);
}

.home-hero::before,
.home-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    pointer-events: none;
    width: 280px;
    height: 280px;
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    right: -70px;
    top: -90px;
}

.home-hero::after {
    width: 180px;
    height: 180px;
    right: 90px;
    top: 70px;
}

.home-hero-main {
    min-width: 0;
    flex: 1;
}

.home-eyebrow {
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.home-hero h1 {
    margin: var(--space-3) 0;
    font-size: clamp(23px, 2.3vw, 32px);
    line-height: 1.3;
    letter-spacing: -0.03em;
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.home-hero p {
    color: var(--color-text-secondary);
    line-height: 1.8;
}

.home-hero-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-top: var(--space-6);
}

.home-button {
    min-height: 42px;
    padding: 10px 18px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #ffffff;
    font-size: 13px;
    font-weight: var(--fw-semibold);
}

.home-button:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 8px 20px rgba(40, 92, 229, 0.22);
    color: #ffffff;
}

.home-button-quiet {
    color: var(--color-text-primary);
    border-color: var(--color-border);
    background: rgba(255, 255, 255, 0.75);
}

.home-button-quiet:hover {
    background: #ffffff;
    box-shadow: none;
    color: var(--color-text-primary);
}

.home-hero-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 10px 0 10px 28px;
    border-left: 1px solid var(--color-border);
    max-width: 300px;
}

.home-hero-aside strong {
    font-size: 18px;
    font-weight: var(--fw-semibold);
    color: var(--color-text-primary);
}

.home-hero-aside > span:last-child {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.home-pill {
    padding: 5px 11px;
    border-radius: 99px;
    border: 1px solid var(--color-border);
    background: #ffffff;
    color: var(--color-primary);
    font-size: 11px;
}

/* -------------------- 概览统计 -------------------- */
.home-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 28px 0 var(--space-4);
}

.home-section-heading > span {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.home-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: var(--space-6);
}

.home-stat {
    min-width: 0;
    padding: 21px 22px 17px;
    border: 1px solid #ffffff;
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-1);
    color: inherit;
}

a.home-stat:hover {
    border-color: #c5d4f8;
    background: #f8faff;
}

.home-stat-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--color-text-secondary);
}

.home-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.home-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-icon-cards { color: #087f85; background: #eaf8f7; }
.home-icon-agents,
.home-icon-materials { color: #8053b5; background: #f3edfc; }
.home-icon-logs,
.home-icon-balance { color: #ab701c; background: #fff6e7; }
.home-icon-apps,
.home-icon-settings { color: var(--color-primary); background: var(--color-primary-light); }

.home-stat-value {
    display: block;
    margin: var(--space-3) 0 17px;
    font-size: clamp(24px, 2.5vw, 34px);
    line-height: 1.2;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.home-stat-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-3);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

/* -------------------- 两栏面板 -------------------- */
.home-columns {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.home-panel {
    min-width: 0;
    padding: 25px;
    background: #ffffff;
    border: 1px solid #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-1);
}

/* 右栏：账户与有效期 */
.home-account {
    min-width: 0;
}

.home-panel.home-account {
    display: flex;
    flex-direction: column;
}

.home-account .home-account-list {
    margin-top: 13px;
}

.home-account .home-footnote {
    margin-top: auto;
}

.home-panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.home-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--color-text-tertiary);
    font-size: 10px;
    letter-spacing: 0.13em;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
}

.home-panel-tag {
    font-size: 11px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: 999px;
    padding: 5px 9px;
}

.home-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

.home-action {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: 17px 13px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
}

.home-action:hover {
    border-color: #c5d4f8;
    background: #f8faff;
    text-decoration: none;
}

.home-action-copy {
    flex: 1;
    min-width: 0;
}

.home-action-copy strong {
    display: block;
    font-size: 13px;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.home-action-copy small {
    display: block;
    color: var(--color-text-secondary);
    font-size: 11px;
    line-height: 1.6;
}

.home-action-arrow {
    color: var(--color-text-tertiary);
    flex: 0 0 auto;
}

.home-note {
    margin-top: var(--space-5);
    padding: 15px 17px;
    background: var(--color-surface-alt);
    border-radius: 14px;
    border: 1px solid var(--color-border);
    font-size: var(--text-xs);
}

.home-note strong {
    color: var(--color-text-primary);
    font-weight: var(--fw-semibold);
}

.home-note p {
    color: var(--color-text-secondary);
    margin-top: 5px;
    line-height: 1.8;
}

/* -------------------- 比例条 -------------------- */
.home-ratios {
    display: grid;
    gap: 26px;
}

.home-ratios-compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-top: var(--space-6);
}

.home-ratio {
    min-width: 0;
}

.home-ratio-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    align-items: center;
}

.home-ratio-heading strong {
    font-weight: var(--fw-medium);
}

.home-ratio-heading > span {
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
    font-weight: var(--fw-semibold);
}

.home-meter {
    height: 7px;
    border-radius: 99px;
    overflow: hidden;
    background: #e8eef8;
    margin: 13px 0 9px;
}

.home-meter > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #285ce5, #7aa0f5);
}

.home-ratio:nth-child(2) .home-meter > span {
    background: linear-gradient(90deg, #13979b, #6fc5bf);
}

.home-ratio-caption {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px 10px;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.home-ratio-caption b {
    color: var(--color-text-primary);
    font-weight: var(--fw-medium);
    font-variant-numeric: tabular-nums;
}

/* -------------------- 账户与有效期 -------------------- */
.home-footnote {
    border-top: 1px solid var(--color-border);
    padding-top: 18px;
    margin-top: var(--space-6);
    font-size: var(--text-xs);
    line-height: 1.8;
    color: var(--color-text-secondary);
}

.home-status {
    color: #087f65;
    background: #edf9f3;
    padding: 5px 10px;
    border: 1px solid #d9efe4;
    border-radius: 99px;
    font-size: 11px;
    white-space: nowrap;
}

.home-status-disabled {
    color: #b42318;
    background: #fff1f0;
    border-color: #f6d6d2;
}

.home-expiry {
    padding: var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid #d7e2f8;
    background: linear-gradient(120deg, #eef3ff, #f8faff);
}

.home-expiry > span {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.home-expiry strong {
    display: block;
    margin: 9px 0;
    font-size: 22px;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.home-expiry p {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.home-account-list {
    margin-top: 13px;
}

.home-account-list > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 18px;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-xs);
}

.home-account-list dt {
    flex: 0 0 auto;
    color: var(--color-text-secondary);
}

.home-account-list dd {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
    color: var(--color-text-primary);
}

.home-account-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px var(--space-4);
    margin-top: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    color: var(--color-primary);
    font-size: var(--text-xs);
}

.home-account-link:hover {
    background: var(--color-primary-light);
    text-decoration: none;
}

.home-bottom-note {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
    margin: 23px 2px 6px;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.home-bottom-note a {
    color: var(--color-primary);
}


/* ============================================================================
   18 弹窗
   ============================================================================ */
.modal-root {
    position: relative;
    z-index: 1000;
}

.modal-root:empty {
    display: none;
}

.modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(23, 35, 56, 0.32);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, visibility 0.16s ease;
    overflow-y: auto;
}

/* app.js 打开时加 .modal-open */
.modal-mask.modal-open {
    opacity: 1;
    visibility: visible;
}

/* 服务端渲染的静态片段默认可见（无 .modal-open 时也不隐藏） */
.modal-mask.modal-open,
.modal-mask[data-modal-mask]:not(.modal-loading) {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    height: fit-content;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--color-surface, #ffffff);
    background-color: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow-2);
    transform: translateY(6px) scale(0.995);
    transition: transform 0.16s ease;
}

.modal-mask.modal-open .modal {
    transform: translateY(0) scale(1);
}

.modal-sm {
    max-width: 400px;
}

.modal-wide {
    max-width: 860px;
    height: 720px;
    max-height: calc(100vh - 48px);
}

/* 兼容原站命名 */
.modal-card {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow-2);
    transform: translateY(6px) scale(0.995);
    transition: transform 0.16s ease;
}

/* 打开时归位（和 .modal 一致） */
.modal-mask.modal-open .modal-card,
.modal-mask[data-modal-mask]:not(.modal-loading) .modal-card {
    transform: translateY(0) scale(1);
}

/* 卡片内的头部与内容都保持白底，避免透出后面的页面 */
.modal-card > .card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
    flex: 0 0 auto;
}

.modal-card > .modal-scroll-body,
.modal-card > .card-body {
    background: #ffffff;
    overflow-y: auto;
    flex: 1 1 auto;
}

.modal-card .table {
    margin-bottom: 0;
}

.modal-card-lg {
    max-width: 860px;
    height: 720px;
    max-height: calc(100vh - 48px);
}

.modal-header {
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    flex: 0 0 auto;
}

.modal-title {
    font-size: var(--text-base);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-heading);
    min-width: 0;
    overflow-wrap: anywhere;
}

.modal-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-tertiary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 3px; }
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--color-text-tertiary); }

.modal-body > .form-group:last-child,
.modal-body > .form-grid:last-child {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex: 0 0 auto;
}

.modal-footer .btn { min-width: 88px; }

/* 弹窗内表单 */
.modal form:not(.filter-form) {
    padding: var(--space-6);
    overflow-y: auto;
    min-height: 0;
}

.modal .form-narrow {
    max-width: none;
    width: 100%;
}

.modal .modal-actions,
.modal .flex.mt-6 {
    flex-shrink: 0;
    justify-content: flex-end;
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.modal-scroll-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: var(--space-6);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.modal-scroll-body::-webkit-scrollbar { width: 6px; }
.modal-scroll-body::-webkit-scrollbar-track { background: transparent; }
.modal-scroll-body::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 3px; }

/* 加载中弹窗 */
.modal-loading .modal {
    max-width: 320px;
}

.modal-loading .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
}

.loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid var(--color-primary-light);
    border-top-color: var(--color-primary);
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

.confirm-text {
    color: var(--color-text-secondary);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

/* 兼容原站确认框命名 */
.confirm-mask {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(23, 35, 56, 0.32);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.confirm-card {
    width: 100%;
    max-width: 380px;
    padding: var(--space-6);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-2);
    animation: toast-in 0.18s ease-out;
}

.confirm-title {
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--space-2);
}

.confirm-message {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

/* 媒体预览（公告图片 / 视频） */
.media-preview-mask {
    z-index: 2200;
}

.media-preview-card {
    position: relative;
    max-width: min(920px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    border: 1px solid #ffffff;
    box-shadow: var(--shadow-2);
    overflow: auto;
}

.media-preview-card img,
.media-preview-card video {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: var(--radius-sm);
}

.media-preview-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(23, 35, 56, 0.65);
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}


/* ============================================================================
   19 Toast
   ============================================================================ */
.toast-wrap {
    position: fixed;
    top: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    pointer-events: none;
    max-width: calc(100vw - 40px);
}

.toast-wrap:empty {
    display: none;
}

.toast-item {
    min-width: 220px;
    max-width: 360px;
    padding: 14px var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-2);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
    pointer-events: auto;
    animation: toast-in 0.18s ease-out;
    overflow-wrap: anywhere;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error { border-left: 4px solid var(--color-error); }
.toast-info { border-left: 4px solid var(--color-primary); }
.toast-warning { border-left: 4px solid var(--color-warning); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ============================================================================
   20 设备预览浮层
   ============================================================================ */
.device-preview-pop {
    position: absolute;
    z-index: 9998;
    width: max-content;
    max-width: min(420px, calc(100vw - 32px));
    padding: var(--space-3) var(--space-3) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-2);
    animation: toast-in 0.14s ease-out;
}

.device-preview-text {
    min-width: 0;
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.device-preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-surface-alt);
}

/* 兼容原站浮层命名 */
.device-preview {
    position: absolute;
    z-index: 80;
    left: 0;
    top: calc(100% + 6px);
    width: max-content;
    max-width: min(420px, calc(100vw - 32px));
    padding: var(--space-2) 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-2);
}

.device-preview span {
    min-width: 0;
    color: var(--color-text-primary);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
    line-height: 1.45;
}

.device-preview button {
    height: 30px;
}


/* ============================================================================
   21 公告
   ============================================================================ */
.announce-content {
    font-size: var(--text-sm);
    line-height: 1.8;
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.announce-content img,
.announce-content video,
.rich-content img,
.rich-content video {
    display: block;
    max-width: 100%;
    height: auto;
    margin: var(--space-3) 0;
    border-radius: var(--radius-sm);
}

.announce-media {
    display: block;
    max-width: 100%;
    height: auto;
    margin-top: var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.announce-media-wrap {
    margin-top: var(--space-3);
}

.announcement-media-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.announcement-media-preview {
    display: block;
    max-width: 100%;
    max-height: 260px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.announcement-media-open {
    display: inline-flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    max-width: 100%;
}

.rich-content {
    font-size: var(--text-sm);
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.announce-list-item {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.announce-list-item + .announce-list-item {
    margin-top: var(--space-2);
}

.announce-list-item:hover {
    border-color: #c5d4f8;
    background: #f8faff;
}

.announce-list-title {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.announce-list-time {
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.announcement-detail-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.announcement-detail-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: var(--fw-semibold);
}

.announcement-detail-content {
    margin-top: var(--space-3);
    line-height: 1.8;
}

.announcement-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.announcement-history-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.announcement-history-item > button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: none;
    background: var(--color-surface);
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.announcement-history-item > button:hover {
    background: var(--color-surface-alt);
}

.announcement-history-item strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--fw-medium);
}

.announcement-history-item span {
    flex: 0 0 auto;
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
}

.announcement-history-body {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    font-size: var(--text-sm);
    line-height: 1.8;
}

.announcement-force-progress {
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.announcement-header-actions {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.mode-notice,
.mode-update {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}


/* ============================================================================
   22 登录页与滑块验证
   ============================================================================ */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background:
        radial-gradient(ellipse at 80% 20%, #dce8ff 0, transparent 42%),
        radial-gradient(ellipse at 20% 80%, #eee9ff 0, transparent 40%),
        linear-gradient(#f9fafc, #f2f6fc);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.86);
    border-radius: 22px;
    border: 1px solid #ffffff;
    box-shadow: 0 16px 40px rgba(36, 53, 80, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: var(--space-8);
}

.auth-card h1 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
    text-align: center;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
}

.auth-subtitle {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.7;
}

.auth-card .form-input,
.auth-card .form-select {
    min-height: 44px;
}

.slider-captcha {
    position: relative;
    width: 100%;
    height: 40px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    user-select: none;
    overflow: hidden;
    touch-action: none;
}

.slider-captcha .slider-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: #d1fae5;
    border-radius: var(--radius-sm);
    transition: none;
}

.slider-captcha .slider-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.slider-captcha .slider-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 2;
    transition: none;
}

.slider-captcha .slider-thumb:active {
    cursor: grabbing;
}

.slider-captcha .slider-thumb svg {
    width: 18px;
    height: 18px;
    color: var(--color-text-secondary);
}

.slider-captcha.success {
    border-color: var(--color-success);
}

.slider-captcha.success .slider-track {
    background: #a7f3d0;
    width: 100%;
}

.slider-captcha.success .slider-thumb {
    background: var(--color-success);
    border-color: var(--color-success);
}

.slider-captcha.success .slider-thumb svg {
    color: #ffffff;
}

.slider-captcha.success .slider-text {
    color: #065f46;
}

/* 安装向导（install.php）轻量适配 */
.install-wrap {
    min-height: 100vh;
    padding: var(--space-8) var(--space-4);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.install-card {
    width: 100%;
    max-width: 640px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.install-header {
    padding: var(--space-6) var(--space-8);
    border-bottom: 1px solid var(--color-border);
}

.install-header h1 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-1);
}

.install-header p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.install-body { padding: var(--space-8); }

.install-footer {
    padding: var(--space-4) var(--space-8);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-surface-alt);
}

.stepper {
    display: flex;
    align-items: center;
    padding: var(--space-6) var(--space-8);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    flex-shrink: 0;
}

.step.active { color: var(--color-primary); font-weight: var(--fw-semibold); }
.step.active .step-num { background: var(--color-primary); border-color: var(--color-primary); color: #ffffff; }
.step.done { color: var(--color-success); }
.step.done .step-num { background: var(--color-success); border-color: var(--color-success); color: #ffffff; }
.step-sep { flex: 1; height: 1px; background: var(--color-border-strong); min-width: 20px; }

.check-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
}

.check-list li:last-child { border-bottom: none; }
.check-list .check-name { color: var(--color-text-primary); }
.check-list .check-value { display: flex; align-items: center; gap: var(--space-2); color: var(--color-text-secondary); }


/* ============================================================================
   23 页面专有块（标签页 / 素材选择 / 价格 / 设置 / 构建）
   ============================================================================ */
/* -------------------- 标签页 -------------------- */
.tabs {
    display: flex;
    gap: var(--space-2);
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 var(--space-4);
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.tab-item:hover {
    color: var(--color-text-primary);
    text-decoration: none;
}

.tab-item.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: var(--fw-semibold);
}

.agent-tab-panel,
.app-tab-panel,
.build-tab {
    min-width: 0;
}

/* -------------------- 素材选择器 -------------------- */
.material-picker-list {
    min-height: 100px;
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.material-picker-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
}

.material-picker-item:last-child { border-bottom: none; }

.material-picker-item:hover { background: var(--color-surface-alt); }

.material-picker-name {
    font-weight: var(--fw-medium);
    color: var(--color-text-primary);
}

.material-picker-remark,
.material-picker-source {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    overflow-wrap: anywhere;
}

.parent-material-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: 999px;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

/* -------------------- 应用价格 -------------------- */
.app-price-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.app-price-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    overflow: hidden;
}

.app-price-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

.app-price-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
}

.app-price-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    padding: var(--space-4);
}

.app-price-collapse {
    border-top: 1px solid var(--color-border);
}

.app-price-collapse[hidden] {
    display: none !important;
}

.price-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.price-item-head {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.price-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.price-switch-track {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: var(--color-border-strong);
    transition: background 0.18s ease;
    flex: 0 0 auto;
}

.price-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(36, 53, 80, 0.24);
    transition: transform 0.18s ease;
}

.price-switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.price-switch input[type="checkbox"]:checked + .price-switch-track {
    background: var(--color-primary);
}

.price-switch input[type="checkbox"]:checked + .price-switch-track .price-switch-knob {
    transform: translateX(16px);
}

/* -------------------- 按钮配置 / 平台选择 -------------------- */
.button-config-toolbar,
.button-config-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-3);
}

.button-config-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.button-config-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.build-platform-switch {
    display: inline-flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.platform-opt {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--text-xs);
    cursor: pointer;
    background: var(--color-surface);
}

.platform-opt:has(input:checked) {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.build-usage-note {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    line-height: 1.7;
}

.build-delay-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.build-delay-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.build-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: 999px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    font-size: var(--text-xs);
    cursor: pointer;
}

.build-tag:hover {
    color: var(--color-error);
    border-color: #fecaca;
}

.build-encrypt-key-input,
.build-delay-input {
    max-width: 260px;
}

/* -------------------- 颜色选择 / 图标上传 -------------------- */
.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.color-item {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--color-border-strong);
    cursor: pointer;
}

.icon-upload-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.icon-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* -------------------- 设置页 -------------------- */
.settings-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
    align-items: stretch;
}

.settings-card {
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.settings-card .card-body { flex: 1; }

.settings-card-head {
    padding: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--color-surface-alt), #ffffff);
}

.settings-card-head h3 {
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--space-1);
}

.settings-card-head p {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.settings-logo-large {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-1);
    flex: 0 0 auto;
}

.settings-logo-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-form { max-width: 560px; }

.settings-upload-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.settings-upload-main { flex: 1; min-width: 0; }

.settings-actions {
    padding-top: var(--space-2);
    display: flex;
    justify-content: flex-start;
}

.settings-actions .btn { min-width: 132px; height: 42px; }

.system-logo-preview {
    width: 72px;
    height: 72px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-surface-alt);
    flex: 0 0 auto;
}

.system-logo-preview img { width: 100%; height: 100%; object-fit: cover; }

.system-logo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-tertiary);
    font-size: var(--text-xs);
}

/* -------------------- 环境检查 / 构建 -------------------- */
.build-env-card,
.build-log-card {
    padding: var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.build-log-card { margin-top: var(--space-4); }

.env-check-list {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.env-check-row,
.env-check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.env-check-row:last-child,
.env-check-item:last-child { border-bottom: none; }

/* -------------------- 预览 / 插件下载 -------------------- */
.preview-toolbar {
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 10002;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    justify-content: flex-end;
    max-width: calc(100% - 40px);
}

.preview-mode-label {
    background: rgba(0, 0, 0, 0.6);
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
    color: #ffffff;
    font-size: var(--text-xs);
    display: inline-flex;
    align-items: center;
    margin-right: var(--space-1);
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

.plugin-download-list-scroll {
    max-height: 320px;
    overflow-y: auto;
}

.ai-prompt-text { font-size: 13px; line-height: 1.6; }

/* 兼容旧命名（构建历史 / 上传行） */
.config-text {
    min-height: 48px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: var(--text-xs);
}

.btn-build { margin-top: var(--space-2); }
.delay-input { max-width: 200px; }
.history-file-name {
    display: block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-encrypt-key { max-width: 180px; }
.history-actions { display: flex; flex-wrap: wrap; gap: var(--space-1); }


/* ============================================================================
   24 响应式
   ============================================================================ */

/* -------------------- ≤1200px -------------------- */
@media (max-width: 1200px) {
    .home-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-hero-aside {
        display: none;
    }

    .home-columns {
        grid-template-columns: 1fr;
    }

    .app-price-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* -------------------- ≤900px：侧栏抽屉化 -------------------- */
@media (max-width: 900px) {
    html,
    body,
    .layout,
    .main,
    .content {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* 侧栏默认移出视口，.sidebar-open / .open 时滑入 */
    .sidebar {
        width: var(--sidebar-width-drawer);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        z-index: 120;
    }

    .sidebar.sidebar-open,
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    body.sidebar-open {
        position: fixed;
        inset: 0;
        width: 100%;
        overflow: hidden;
        touch-action: none;
    }

    body.sidebar-open .main {
        overflow: hidden;
        touch-action: none;
    }

    .sidebar-brand {
        height: var(--topbar-height);
        padding: 0 22px;
        font-size: 17px;
    }

    .sidebar-logo {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .sidebar-nav { padding: 14px 0; }

    .sidebar-nav .nav-item {
        min-height: 54px;
        margin: 5px 10px;
        padding: 14px 15px;
        gap: 13px;
    }

    .sidebar-nav .nav-item .nav-icon {
        width: 36px;
        height: 36px;
        border-radius: 11px;
    }

    .sidebar-nav .nav-item .nav-icon .icon {
        width: 19px;
        height: 19px;
    }

    .sidebar-nav .nav-item.active::before {
        top: 10px;
        bottom: 10px;
    }

    .main {
        margin-left: 0;
        padding-top: var(--topbar-height-mobile);
    }

    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--topbar-height-mobile);
        padding: 0 var(--space-4);
    }

    .menu-toggle {
        display: inline-flex;
    }

    .topbar-notice {
        min-width: 0;
        height: 30px;
        padding: 0 var(--space-2);
    }

    .topbar-notice marquee { font-size: var(--text-xs); }

    .topbar-user {
        font-size: var(--text-xs);
        gap: var(--space-2);
        white-space: nowrap;
    }

    .topbar-user .user-name {
        display: inline-block;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-user .btn {
        height: 32px;
        padding: 0 var(--space-2);
    }

    .content { padding: var(--space-4); }

    .page-head {
        align-items: flex-start;
        margin-bottom: var(--space-4);
    }

    .settings-layout { grid-template-columns: 1fr; }

    .build-config-grid,
    .build-app-grid,
    .button-config-row {
        grid-template-columns: 1fr;
    }
}

/* -------------------- ≤768px：表格转卡片视图 -------------------- */
@media (max-width: 768px) {
    .card {
        overflow-x: visible;
        border-radius: 14px;
    }

    .card-header {
        padding: var(--space-3);
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .card-body { padding: var(--space-4); }
    .card-footer { padding: var(--space-3); justify-content: stretch; }
    .card-footer .btn { flex: 1; }

    .page-title { font-size: var(--text-lg); }

    .form-row { flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; gap: var(--space-3); }
    .form-group { margin-bottom: var(--space-3); }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px;
        height: 44px;
        min-height: 44px;
    }

    .form-textarea {
        height: auto;
        min-height: 88px;
    }

    .form-input[type="date"],
    .form-input[type="datetime-local"],
    .form-input[type="number"] {
        appearance: none;
        -webkit-appearance: none;
    }

    .btn {
        min-height: 42px;
        font-size: var(--text-sm);
    }

    .btn-sm {
        min-height: 34px;
        font-size: var(--text-xs);
        padding: var(--space-2) var(--space-3);
    }

    .filter-form {
        width: 100%;
    }

    .filter-form .form-input,
    .filter-form .form-select,
    .filter-form .btn {
        height: 42px;
        flex: 1 1 calc(50% - var(--space-2));
        min-width: 0;
        justify-content: center;
        font-size: 16px;
    }

    .filter-form .btn { font-size: var(--text-sm); }

    .bulk-bar {
        padding: var(--space-3);
        gap: var(--space-2);
    }

    .bulk-bar .form-select,
    .bulk-bar .btn {
        flex: 1 1 calc(50% - var(--space-2));
        min-width: 0;
    }

    .list-action-row {
        flex-wrap: wrap;
    }

    .view-toggle {
        align-self: flex-start;
    }

    /* 表格 → 卡片 */
    .view-list-table-scroll {
        overflow: visible;
    }

    .view-list-table-scroll table {
        display: block;
        width: 100%;
        table-layout: auto;
    }

    .view-list-table-scroll thead {
        display: none;
    }

    .view-list-table-scroll tbody {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-3);
        width: 100%;
    }

    .view-list-table-scroll tbody tr {
        display: flex;
        flex-direction: column;
        min-width: 0;
        background: linear-gradient(180deg, #ffffff, #fcfdff);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: var(--space-4);
        box-shadow: var(--shadow-3);
    }

    .view-list-table-scroll tbody tr:nth-child(even),
    .view-list-table-scroll tbody tr:hover {
        background: linear-gradient(180deg, #ffffff, #fcfdff);
    }

    .view-list-table-scroll tbody tr:hover td {
        background: transparent;
    }

    .view-list-table-scroll tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: var(--space-3);
        width: auto;
        max-width: none;
        min-width: 0;
        padding: var(--space-2) 0;
        border-bottom: 1px dashed var(--color-surface-alt);
        text-align: left;
        font-size: var(--text-sm);
    }

    .view-list-table-scroll tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    /* 用 data-label 显示表头 */
    .view-list-table-scroll tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        min-width: 76px;
        max-width: 46%;
        color: var(--color-text-secondary);
        font-size: var(--text-xs);
        line-height: 1.7;
        word-break: break-word;
    }

    .view-list-table-scroll tbody td[data-label=""]::before {
        display: none;
    }

    .view-list-table-scroll tbody td > .flex,
    .view-list-table-scroll tbody td > .btn,
    .view-list-table-scroll tbody td > .badge,
    .view-list-table-scroll tbody td > .key-inline,
    .view-list-table-scroll tbody td > .device-id-text,
    .view-list-table-scroll tbody td > .card-copy-text {
        min-width: 0;
        max-width: 100%;
    }

    .view-list-table-scroll tbody td[data-label="操作"] .flex {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .card-select-cell {
        width: auto;
        justify-content: flex-start;
    }

    .cell-content,
    .account-table-ellipsis,
    .device-id-cell .device-id-text,
    .card-copy-text {
        max-width: 100%;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }

    .device-id-text { word-break: break-all; }

    .log-mobile-select-label {
        display: block;
        font-size: var(--text-xs);
        color: var(--color-text-secondary);
    }

    /* 分页换行 */
    .pagination {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
        padding: var(--space-4) var(--space-2);
    }

    .pagination-info { text-align: center; }

    .pagination-pages {
        justify-content: center;
        flex-wrap: wrap;
    }

    .pagination-size {
        justify-content: center;
    }

    .pagination a,
    .pagination .page-link {
        min-width: 34px;
        height: 34px;
        padding: 0 var(--space-2);
    }

    .tabs { gap: var(--space-1); }

    .tab-item {
        padding: 0 var(--space-3);
        font-size: var(--text-sm);
    }

    .material-page-header,
    .agent-material-page-header {
        align-items: flex-start;
    }

    .material-page-header > .flex {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-2);
    }

    .material-page-header > .flex .btn {
        width: 100%;
        padding-left: var(--space-2);
        padding-right: var(--space-2);
    }

    .app-price-grid { grid-template-columns: 1fr; }

    /* 弹窗贴底布局 */
    .modal-mask {
        align-items: flex-end;
        padding: 0;
    }

    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(12px);
    }

    .modal-mask.modal-open .modal {
        transform: translateY(0);
    }

    .modal-wide,
    .modal-card-lg {
        height: auto;
        max-height: 92vh;
    }

    .modal-header,
    .modal-footer { padding: var(--space-3) var(--space-4); }
    .modal-body,
    .modal-scroll-body { padding: var(--space-4); }

    .modal-footer .btn { flex: 1; }

    .toast-wrap {
        top: auto;
        bottom: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
        align-items: stretch;
    }

    .toast-item {
        min-width: 0;
        max-width: none;
    }

    .device-preview-pop {
        max-width: calc(100vw - 24px);
    }

    /* 徽章 / 提示字号微调 */
    .badge { font-size: 11px; }
    .alert { font-size: var(--text-xs); }

    .settings-card-head { align-items: flex-start; }
    .settings-logo-large { width: 64px; height: 64px; border-radius: 16px; }
    .settings-upload-row { align-items: flex-start; }
}

/* -------------------- ≤600px：首页工作台 -------------------- */
@media (max-width: 600px) {
    .home-workspace { padding: var(--space-2) var(--space-1); }

    .home-hero {
        padding: 25px 21px;
        border-radius: 14px;
        gap: var(--space-4);
    }

    .home-hero::before,
    .home-hero::after { display: none; }

    .home-eyebrow { font-size: 10px; letter-spacing: 0.08em; }
    .home-hero h1 { font-size: 23px; }
    .home-hero p { font-size: var(--text-xs); }
    .home-hero-actions { gap: var(--space-2); margin-top: var(--space-5); }

    .home-button {
        min-height: 44px;
        padding: 10px var(--space-3);
        gap: 10px;
        font-size: var(--text-xs);
    }

    .home-section-heading { margin-top: 23px; }
    .home-section-heading > span { font-size: 10px; }

    .home-stats { gap: 10px; margin-bottom: var(--space-4); }
    .home-stat { padding: 15px 13px; border-radius: 12px; }
    .home-stat-top { font-size: var(--text-xs); }
    .home-stat-top .home-icon { width: 30px; height: 30px; border-radius: 8px; }
    .home-stat-top svg { width: 17px; height: 17px; }
    .home-stat-value { font-size: 25px; margin: 14px 0; }
    .home-stat-bottom { font-size: 10px; }

    .home-columns { gap: var(--space-4); }
    .home-panel { padding: var(--space-5) var(--space-4); }
    .home-action-grid { grid-template-columns: 1fr; gap: 10px; }
    .home-action { padding: 14px; }
    .home-ratios-compact { grid-template-columns: 1fr; }
    .home-expiry strong { font-size: 20px; }

    .auth-card { padding: var(--space-6) var(--space-4); }
}

/* -------------------- ≤420px：极窄屏 -------------------- */
@media (max-width: 420px) {
    .content { padding: var(--space-2); }
    .sidebar { width: 86vw; }
    .topbar-notice { display: none; }
    .page-actions .btn { flex: 1 1 100%; }
    .card-header { padding: var(--space-2); }
    .card-body { padding: var(--space-3); }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }
}


/* ============================================================================
   25 辅助与无障碍
   ============================================================================ */
/* 桌面精确指针设备：关闭过渡动效，避免 hover 抖动 */
@media (hover: hover) and (pointer: fine) {
    .btn,
    .nav-item,
    .pagination a,
    .pagination .page-link,
    .view-toggle-btn,
    .tab-item,
    .material-picker-item,
    .env-check-row {
        transition: none;
    }
}

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* 键盘聚焦可见 */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* 屏幕阅读器专用文本 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 打印：去掉背景与阴影 */
@media print {
    .sidebar,
    .sidebar-overlay,
    .topbar,
    .toast-wrap,
    .modal-root,
    .page-actions,
    .bulk-bar,
    .view-toggle,
    .pagination {
        display: none !important;
    }

    .main { margin-left: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #ffffff; }
}

/* =====================================================================
 * 抓包记录（日志管理 · 抓包 tab）
 * ===================================================================== */
.capture-device-cell{display:flex;flex-direction:column;gap:4px;min-width:0}
.capture-blacklist-btn{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;padding:2px 8px;font-size:12px;line-height:1.6;color:var(--color-primary);background:var(--color-primary-light,#e8efff);border:0;border-radius:6px;cursor:pointer;white-space:nowrap}
.capture-blacklist-btn:hover{background:#d8e4ff}
.capture-blacklist-btn:disabled{opacity:.55;cursor:not-allowed}
.capture-summary-cell{max-width:320px}
.capture-summary-text{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.capture-summary-btn{margin-left:6px;padding:0;font-size:12px;color:var(--color-primary);background:none;border:0;cursor:pointer}
.capture-summary-btn:hover{text-decoration:underline}
.capture-summary-pre{margin:0;padding:14px 16px;max-height:60vh;overflow:auto;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:1.7;color:#172338;background:#f4f7fc;border-radius:10px;white-space:pre-wrap;word-break:break-all}
.badge-danger{color:#b42318;background:#fee4e2}
.badge-success{color:#067647;background:#d1fadf}

/* 卡片视图下的抓包行 */
.card-view .capture-row .capture-device-cell{align-items:flex-start}
@media (max-width:768px){
  .capture-summary-cell{max-width:none}
  .capture-summary-text{white-space:normal}
}

/* =====================================================================
 * 插件打包弹窗
 * ===================================================================== */
.plugin-build-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding-top:0;border-top:0}
.plugin-build-tip{font-size:12.5px;line-height:1.6}
.plugin-download-list-scroll{max-height:52vh;overflow:auto}
.plugin-download-list-scroll .table{margin-bottom:0}

/* =====================================================================
 * 素材库：使用提示与被共享素材的「使用」按钮
 * ===================================================================== */
.material-usage-hint{flex:1 1 320px;min-width:260px;color:var(--color-text-secondary,#637188);font-size:12.5px;line-height:1.7}
.list-action-row{align-items:flex-start}
@media (max-width:768px){
  .list-action-row{flex-direction:column;align-items:stretch}
}
