/* ================================================== */
/* 卡密系统 - 全局样式 (iPhone 黑白风格)               */
/* ================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-bg: #f5f5f7;
    --color-card: #ffffff;
    --color-text: #1d1d1f;
    --color-text-2: #86868b;
    --color-text-3: #aeaeb2;
    --color-border: #d2d2d7;
    --color-border-2: #e8e8ed;
    --color-primary: #1d1d1f;
    --color-primary-h: #000000;
    --color-success: #34c759;
    --color-error: #ff3b30;
    --color-warning: #ff9500;
    --color-blue: #0071e3;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --max-width: 1200px;
    --nav-height: 52px;
}

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: -apple-system, "SF Pro Display", "SF Pro Text", "Helvetica Neue",
                 "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-h); }
.btn-secondary { background: var(--color-card); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border-2); }
.btn-danger { background: var(--color-error); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--color-text); }
.btn-ghost:hover { background: var(--color-border-2); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn i { font-size: 14px; }

/* ---------- 登录页 ---------- */
.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--color-bg);
    padding: 20px;
}
.login-card {
    background: var(--color-card);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    background: var(--color-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
}
.login-title { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; }
.login-subtitle { color: var(--color-text-2); font-size: 14px; margin: 8px 0 32px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 16px;
    background: var(--color-bg);
    color: var(--color-text);
    transition: border-color var(--transition);
    -webkit-appearance: none;
}
.login-input:focus { outline: none; border-color: var(--color-primary); }

/* ---------- 导航栏 ---------- */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--color-border-2);
}
.nav-bar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.nav-left { display: flex; align-items: center; gap: 8px; }
.nav-right { display: flex; align-items: center; gap: 4px; }
.nav-btn {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text);
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
    font-size: 16px;
}
.nav-btn:hover { background: var(--color-border-2); }
.nav-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }

/* ---------- 主体 ---------- */
.main-content { max-width: var(--max-width); margin: 0 auto; padding: 24px 16px 80px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title { font-size: 28px; font-weight: 700; letter-spacing: -0.8px; }
.page-subtitle { color: var(--color-text-2); font-size: 14px; margin-top: 4px; }

/* ---------- 应用卡片 ---------- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.app-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    border: 1px solid var(--color-border-2);
}
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.app-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.app-card-icon {
    width: 44px; height: 44px;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    color: var(--color-text);
    font-size: 18px;
}
.app-card-name { font-size: 18px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.3px; }
.app-card-key {
    font-size: 11px; color: var(--color-text-3);
    font-family: "SF Mono", "Monaco", monospace;
    background: var(--color-bg); padding: 3px 8px; border-radius: 6px;
    display: inline-block; margin-top: 4px;
    word-break: break-all;
}
.app-card-stats { display: flex; gap: 16px; margin-top: 16px; }
.stat-item { flex: 1; }
.stat-label { font-size: 12px; color: var(--color-text-2); margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.stat-value.unused { color: var(--color-text); }
.stat-value.active { color: var(--color-success); }
.stat-value.expired { color: var(--color-text-3); }
.app-card-tags { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.tag {
    font-size: 11px; padding: 3px 10px; border-radius: 100px;
    font-weight: 500; display: inline-flex; align-items: center; gap: 4px;
}
.tag i { font-size: 10px; }
.tag-free { background: #f0fff4; color: #006e2e; }
.tag-lock { background: #fff4e6; color: #b45309; }
.tag-globe { background: #e6f0ff; color: #0044cc; }
.tag-normal { background: var(--color-bg); color: var(--color-text-2); }

/* 空状态 */
.empty-state { text-align: center; padding: 60px 20px; color: var(--color-text-2); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--color-text); }
.empty-state p { font-size: 14px; }

/* ---------- 统计栏 ---------- */
.stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.stats-card {
    flex: 1;
    min-width: 120px;
    background: var(--color-card);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    border: 1px solid var(--color-border-2);
}
.stats-card-label { font-size: 12px; color: var(--color-text-2); }
.stats-card-value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -0.6px; }

/* ---------- Tab ---------- */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--color-border-2);
    border-radius: var(--radius-md);
    padding: 3px;
    width: fit-content;
}
.tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-2);
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
    height: 36px;
    display: inline-flex;
    align-items: center;
}
.tab.active { background: var(--color-card); color: var(--color-text); box-shadow: var(--shadow-sm); }

/* ---------- 卡密表格 ---------- */
.card-table-wrap {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-2);
    overflow: hidden;
    overflow-x: auto;
}
.card-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.card-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-2);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border-2);
    white-space: nowrap;
}
.card-table td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border-2);
    white-space: nowrap;
}
.card-table tr:last-child td { border-bottom: none; }
.card-table tr:hover { background: var(--color-bg); }
.card-key-text {
    font-family: "SF Mono", "Monaco", "Courier New", monospace;
    font-size: 12px;
    font-weight: 500;
}
.status-badge {
    font-size: 11px; padding: 2px 10px; border-radius: 100px; font-weight: 500;
    display: inline-block;
}
.status-unused { background: #e8f0fe; color: #1a56db; }
.status-active { background: #e6f9ed; color: #006e2e; }
.status-expired { background: #fef2f2; color: #991b1b; }

.row-actions { display: flex; gap: 4px; }
.row-btn {
    width: 30px; height: 30px;
    border: none; background: transparent; border-radius: var(--radius-sm);
    cursor: pointer; color: var(--color-text-2);
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    font-size: 13px;
}
.row-btn:hover { background: var(--color-border-2); color: var(--color-text); }
.row-btn.danger:hover { color: var(--color-error); }

/* 排序按钮组 */
.sort-group {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}
.sort-group .row-btn {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.page-btn {
    min-width: 36px; height: 36px;
    border: 1px solid var(--color-border); background: var(--color-card);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.page-btn:hover { border-color: var(--color-primary); }
.page-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--color-text-2); padding: 0 8px; }

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}
.modal-box {
    background: var(--color-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--color-border-2);
    position: sticky; top: 0; background: var(--color-card); z-index: 1;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.modal-title { font-size: 17px; font-weight: 600; }
.modal-close {
    width: 32px; height: 32px; border: none; background: transparent;
    border-radius: 50%; cursor: pointer; color: var(--color-text-2);
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
    font-size: 15px;
}
.modal-close:hover { background: var(--color-border-2); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--color-border-2);
    display: flex; gap: 12px; justify-content: flex-end;
}

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    font-size: 14px; background: var(--color-card); color: var(--color-text);
    transition: border-color var(--transition); -webkit-appearance: none;
    font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--color-primary);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--color-text-2); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--color-border); border-radius: 26px; transition: var(--transition);
}
.switch-slider::before {
    content: ""; position: absolute; height: 22px; width: 22px; left: 2px; bottom: 2px;
    background: #fff; border-radius: 50%; transition: var(--transition);
}
.switch input:checked + .switch-slider { background: var(--color-success); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }
.switch-label { display: flex; align-items: center; gap: 10px; }

/* ---------- 自定义选项组（替代 select） ---------- */
.opt-group {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.opt-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 14px; font-size: 14px; cursor: pointer;
    border-bottom: 1px solid var(--color-border-2);
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.opt-item:last-child { border-bottom: none; }
.opt-item:active { background: var(--color-bg); }
.opt-item.selected {
    background: rgba(0, 113, 227, 0.06);
    color: var(--color-blue);
    font-weight: 600;
}
.opt-item .opt-check {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--color-border); display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
    transition: all var(--transition); font-size: 10px; color: #fff;
}
.opt-item.selected .opt-check {
    background: var(--color-blue); border-color: var(--color-blue);
}
.opt-item .opt-count {
    font-size: 12px; color: var(--color-text-3); margin-left: 6px; font-weight: 400;
}
.opt-item.selected .opt-count { color: var(--color-blue); opacity: 0.7; }
/* 生成弹窗内并排时的紧凑变体 */
.form-row .opt-group { flex: 1; }
.form-row .opt-item { padding: 9px 12px; font-size: 13px; }

/* ---------- 底部选择器 (Sheet Picker) ---------- */
.sheet-overlay {
    position: fixed; inset: 0; z-index: 1100;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: flex-end; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.sheet-box {
    background: var(--color-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 520px; max-height: 70vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUpSheet 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
}
@keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; border-bottom: 1px solid var(--color-border-2);
    flex-shrink: 0;
}
.sheet-title { font-size: 16px; font-weight: 600; }
.sheet-btn {
    border: none; background: transparent; cursor: pointer;
    font-size: 15px; color: var(--color-blue); font-family: inherit;
    padding: 4px 8px; -webkit-tap-highlight-color: transparent;
}
.sheet-btn.cancel { color: var(--color-text-2); }
.sheet-options { overflow-y: auto; padding: 6px 0; -webkit-overflow-scrolling: touch; }
.sheet-option {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; font-size: 16px; cursor: pointer;
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid var(--color-border-2);
}
.sheet-option:last-child { border-bottom: none; }
.sheet-option:active { background: var(--color-bg); }
.sheet-option.selected { color: var(--color-blue); font-weight: 600; }
.sheet-option .sheet-check {
    color: var(--color-blue); font-size: 16px; opacity: 0;
    transition: opacity var(--transition);
}
.sheet-option.selected .sheet-check { opacity: 1; }
.sheet-option .opt-count {
    font-size: 13px; color: var(--color-text-3); margin-left: 6px; font-weight: 400;
}
.sheet-option.selected .opt-count { color: var(--color-blue); opacity: 0.7; }

/* ---------- 选择触发器 (替代 select 的可点击行) ---------- */
.select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    font-size: 14px; background: var(--color-card); color: var(--color-text);
    cursor: pointer; transition: border-color var(--transition);
    -webkit-appearance: none; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.select-trigger:active { border-color: var(--color-primary); }
.select-trigger .st-value { flex: 1; }
.select-trigger .st-arrow { color: var(--color-text-3); font-size: 12px; margin-left: 8px; }
.select-trigger .opt-count {
    font-size: 12px; color: var(--color-text-3); margin-left: 4px; font-weight: 400;
}

/* ---------- 生成结果 ---------- */
.gen-result {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
    font-family: "SF Mono", "Monaco", monospace;
    font-size: 12px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
}
.gen-result-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast-container {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--color-primary); color: #fff;
    padding: 10px 20px; border-radius: 100px; font-size: 14px;
    box-shadow: var(--shadow-md); animation: toastIn 0.3s ease;
    display: flex; align-items: center; gap: 8px;
    pointer-events: auto;
}
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }
.toast i { font-size: 14px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 加载 ---------- */
.loading {
    position: fixed; inset: 0; z-index: 1500;
    background: rgba(245,245,247,0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 工具栏 ---------- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; min-width: 0; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
.toolbar-right .btn { height: 36px; }

/* ---------- 应用设置 ---------- */
.app-settings {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-2);
    padding: 20px 24px;
    margin-bottom: 20px;
}
.app-settings-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--color-border-2); gap: 16px;
}
.app-settings-row:last-child { border-bottom: none; }
.app-settings-label { font-size: 14px; flex-shrink: 0; }
.app-settings-value { font-size: 14px; color: var(--color-text-2); text-align: right; word-break: break-all; }
.app-settings-actions { display: flex; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border-2); flex-wrap: wrap; }

/* ---------- 验证接口 ---------- */
.api-box {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: "SF Mono", "Monaco", monospace;
    font-size: 12px;
    word-break: break-all;
    line-height: 1.6;
    color: var(--color-text);
    margin-top: 4px;
}

/* ---------- 一键删除下拉菜单 ---------- */
.quick-delete {
    margin-bottom: 16px;
}
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.dropdown-arrow {
    font-size: 10px;
    transition: transform var(--transition);
}
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 10;
    display: none;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}
.dropdown-menu.show {
    display: block;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: transparent;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
    color: var(--color-text);
    font-family: inherit;
}
.dropdown-item:hover {
    background: var(--color-bg);
}
.dropdown-item-danger {
    color: var(--color-error);
}
.dropdown-item-danger:hover {
    background: #fef2f2;
}
.dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}
.dropdown-divider {
    height: 1px;
    background: var(--color-border-2);
    margin: 4px 0;
}
.dropdown-count {
    margin-left: auto;
    color: var(--color-text-3);
    font-size: 11px;
}

/* 工具栏中的下拉框（导出）：右对齐到工具栏右侧 */
.export-dropdown .dropdown-menu {
    right: 0;
    min-width: 180px;
}

/* ---------- 一键删除操作栏 ---------- */
.quick-actions {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px; flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border-2);
    border-radius: var(--radius-md);
}
.quick-actions-label {
    font-size: 13px; font-weight: 500; color: var(--color-text-2);
    display: flex; align-items: center; gap: 6px;
    flex-shrink: 0;
}
.quick-actions-label i { color: var(--color-warning); }
.qa-btn { font-size: 12px; padding: 5px 12px; }
.qa-count { color: var(--color-text-2); font-size: 11px; }

/* ---------- 搜索框 ---------- */
.search-box {
    position: relative;
    display: inline-flex; align-items: center;
}
.search-box i {
    position: absolute; left: 12px;
    color: var(--color-text-3); font-size: 13px;
    pointer-events: none; z-index: 1;
}
.search-box input {
    padding: 8px 76px 8px 34px;
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    font-size: 13px; background: var(--color-card); width: 360px;
    transition: border-color var(--transition); -webkit-appearance: none;
    font-family: inherit; height: 36px;
}
.search-box input:focus { outline: none; border-color: var(--color-primary); }
.search-clear {
    position: absolute; right: 44px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; border: none;
    background: transparent; color: var(--color-text-3); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; transition: color var(--transition); z-index: 1;
    padding: 0; line-height: 1;
}
.search-clear:hover { color: var(--color-text); }
.search-btn {
    position: absolute; right: 1px; top: 1px; bottom: 1px;
    width: 36px; border: none; border-left: 1px solid var(--color-border-2);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--color-card); color: var(--color-text-2);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 13px; transition: all var(--transition);
}
.search-btn:hover { background: var(--color-border-2); color: var(--color-text); }

/* ---------- 批量操作栏 ---------- */
.batch-bar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border-2);
    border-radius: var(--radius-md);
    animation: slideUp 0.2s ease;
}
.batch-bar .batch-info { font-size: 13px; color: var(--color-text-2); flex: 1; }
.batch-bar .batch-info strong { color: var(--color-text); }
.batch-bar .btn { flex-shrink: 0; }

/* ---------- 选择控制栏 ---------- */
.select-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 10px 16px;
    background: var(--color-card);
    border: 1px solid var(--color-border-2);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}
.select-all-page {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--color-text);
    user-select: none;
    -webkit-user-select: none;
}
.select-all-page span { color: var(--color-text-2); }
.select-all-across {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-card);
    color: var(--color-blue);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.select-all-across:hover {
    background: #e6f0ff;
    border-color: var(--color-blue);
}
.selected-all-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text);
    font-weight: 500;
}
.select-bar .btn-danger { margin-left: auto; }

/* ---------- 复选框 ---------- */
.card-checkbox {
    width: 18px; height: 18px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background: var(--color-card);
    transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.card-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}
.card-checkbox:checked::after {
    content: ""; display: block;
    width: 5px; height: 9px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
.card-checkbox:hover { border-color: var(--color-text-2); }

/* 表格中的全选和行选 */
.th-checkbox, .td-checkbox {
    display: flex; align-items: center; justify-content: center;
}

/* ================================================== */
/* 响应式                                              */
/* ================================================== */
@media (max-width: 768px) {
    .page-title { font-size: 22px; }
    .app-grid { grid-template-columns: 1fr; }
    .app-card { padding: 20px; }
    .stat-value { font-size: 20px; }
    .stats-card-value { font-size: 22px; }
    .modal-box { max-width: 100%; border-radius: var(--radius-lg); }
    .modal-body { padding: 20px; }
    .form-row { flex-direction: column; gap: 0; }
    .sheet-box { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

    /* 工具栏手机版：上下两行 */
    .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
    .toolbar-left { gap: 8px; }
    .toolbar-right { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
    .search-box input { width: 100%; flex: 1; padding-right: 76px; }
    .search-clear { right: 44px; }

    /* 表格转卡片 */
    .card-table-wrap { border: none; overflow: visible; }
    .card-table { min-width: 0; display: block; }
    .card-table thead { display: none; }
    .card-table tbody { display: block; }
    .card-table tr {
        display: block; padding: 12px 16px; border-bottom: 1px solid var(--color-border-2);
        background: var(--color-card);
    }
    .card-table td { display: flex; justify-content: space-between; border: none; padding: 4px 0; white-space: normal; }
    .card-table td::before {
        content: attr(data-label); color: var(--color-text-2); font-size: 12px;
        font-weight: normal; margin-right: 12px;
    }
    .card-table td[data-label="操作"] { justify-content: flex-end; }
}

@media (max-width: 480px) {
    .nav-title { font-size: 15px; }
    .main-content { padding: 16px 12px 60px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { justify-content: space-between; }
    .stats-bar { gap: 8px; }
    .stats-card { min-width: calc(50% - 4px); padding: 12px; }
    .tabs { width: 100%; overflow-x: auto; }
    .tab { padding: 8px 12px; font-size: 12px; }
    .search-box input { width: 100%; flex: 1; font-size: 12px; padding-right: 76px; }
    .search-clear { right: 44px; }
    .batch-bar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .batch-bar .btn-sm { font-size: 12px; padding: 5px 10px; }
    .quick-actions { padding: 8px 10px; gap: 6px; }
    .qa-btn { font-size: 11px; padding: 4px 10px; }

    /* 下拉菜单：手机版从按钮左侧向右展开，避免向左溢出 */
    .quick-delete { width: 100%; }
    .dropdown { display: block; }
    .dropdown-menu {
        left: 0;
        right: auto;
        min-width: 0;
        width: max-content;
        max-width: calc(100vw - 24px);
    }
    /* 导出下拉框在工具栏内，保持 inline-block 但同样左对齐展开 */
    .export-dropdown { display: inline-block; }

    /* 选择控制栏手机版 */
    .select-bar { padding: 8px 12px; gap: 8px; }
    .select-bar .btn-danger { margin-left: 0; width: 100%; justify-content: center; }
    .select-all-page { font-size: 12px; }
    .select-all-across { font-size: 11px; padding: 5px 10px; }
}

@media (max-width: 768px) {
    .select-bar .btn-danger { margin-left: 0; }
}
