/* ==========================================================================
   中控端 · 深色毛玻璃主题（PC + 手机）
   - 保留原来所有类名（card / page-header / btn / form-control / custom-modal ...），各模块 JS 不用改结构
   - ≤ 768px：侧边栏换成底部导航，表格自动变成卡片，弹窗变成底部弹层
   ========================================================================== */

:root {
    --bg: #060a13;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-solid: #0f1522;
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.14);
    --text: #e8edf6;
    --text-2: #93a0b8;
    --text-3: #6f7b93;
    --primary: #3b6cf6;
    --primary-2: #6aa0ff;
    --primary-soft: rgba(59, 108, 246, 0.16);
    --success: #5ee0a0;
    --success-soft: rgba(52, 211, 153, 0.13);
    --danger: #ff7a7a;
    --danger-solid: #e5484d;
    --danger-soft: rgba(248, 113, 113, 0.13);
    --warning: #f7b24b;
    --warning-soft: rgba(245, 170, 60, 0.13);
    --orange: #f07a28;
    --radius: 18px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --tabbar-h: 64px;

    /* 兼容旧变量（部分 JS 里写在 style 里） */
    --primary-color: var(--primary);
    --primary-color-rgb: 59, 108, 246;
    --primary-hover: #2f5de0;
    --secondary-color: #64748b;
    --success-color: var(--success);
    --danger-color: var(--danger);
    --warning-color: var(--warning);
    --background-color: var(--bg);
    --card-bg: var(--surface);
    --text-primary: var(--text);
    --text-secondary: var(--text-2);
    --border-color: var(--border);
    --input-bg: rgba(255, 255, 255, 0.04);
    --radius-lg: var(--radius);
    --font-family: var(--font);

    /* Bootstrap 变量 */
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-font-sans-serif: var(--font);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 600px at 100% 0%, rgba(56, 98, 255, 0.17), transparent 60%),
        radial-gradient(700px 520px at 100% 78%, rgba(240, 120, 40, 0.14), transparent 60%),
        radial-gradient(600px 500px at 0% 100%, rgba(56, 98, 255, 0.08), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary-2); text-decoration: none; }
a:hover { color: #a9c6ff; }

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; margin-top: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1.0625rem; }
p { color: var(--text-2); margin-bottom: 1rem; }
small, .small { color: var(--text-2); }
hr { border-color: var(--border); opacity: 1; }
::selection { background: rgba(59, 108, 246, 0.45); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }

/* ==========================================================================
   布局：侧边栏 + 主区域
   ========================================================================== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 16px;
    align-self: flex-start;
    height: calc(100vh - 32px);
    width: 76px;
    flex: 0 0 76px;
    margin: 16px 0 16px 16px;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    z-index: 50;
}

.sidebar .brand-mark {
    width: 44px; height: 44px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; background: linear-gradient(135deg, var(--primary), #7c4dff);
    box-shadow: 0 0 20px rgba(59, 108, 246, 0.45);
    margin-bottom: 10px;
}

.side-link {
    position: relative;
    width: 52px; min-height: 52px;
    border-radius: 14px;
    border: 0; background: transparent;
    color: #7f8aa3;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; cursor: pointer;
    transition: background .2s, color .2s, box-shadow .2s;
}
.side-link svg { width: 22px; height: 22px; }
@media (hover: hover) { .side-link:hover { color: var(--text); background: var(--surface-2); } }
.side-link.active { color: var(--primary-2); background: var(--primary-soft); box-shadow: 0 0 20px rgba(59, 108, 246, 0.3); }
.sidebar .spacer { flex: 1; }

.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; color: #fff;
    background: linear-gradient(135deg, var(--primary), #7c4dff);
    border: 0; cursor: pointer;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 20px 24px 0;
}
.topbar .greet { display: flex; flex-direction: column; }
.topbar .greet-hi { font-size: 13px; color: var(--text-2); }
.topbar .greet-name { font-size: 20px; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.clock-pill {
    font-size: 12px; color: #c9d5ec; background: var(--surface-2);
    border: 1px solid var(--border); padding: 5px 12px; border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.topbar .user-menu { display: none; }

.container,
#main-content {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 16px 24px 48px 20px;
    flex: 1;
}

/* PC 端问候和时间显示在顶部大卡片里，不再单独占一行 */
@media (min-width: 769px) {
    .topbar { display: none; }
}

/* 底部导航（手机） */
.tabbar { display: none; }

/* ==========================================================================
   卡片
   ========================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
    color: var(--text);
    box-shadow: none;
    backdrop-filter: blur(14px);
}
.card h2 { margin-bottom: 1rem; padding-bottom: 0; border-bottom: 0; }

.page-header {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: 0;
}
.page-header h2 { margin: 0; font-size: 1.125rem; }
.page-tools { display: flex; flex: 1 1 auto; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-select { width: auto; min-width: 120px; }

/* 首页统计 */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; margin-bottom: 20px; }
.dash-grid .card { margin: 0; }
.dash-hero { grid-column: span 2; position: relative; overflow: hidden; min-height: 160px; }
.dash-hero svg.wave { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 72px; }
.dash-label { font-size: 13px; color: var(--text-2); }
.dash-num { font-size: 34px; font-weight: 700; line-height: 1.15; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dash-num small { font-size: 15px; font-weight: 500; }
.dash-sub { font-size: 12px; color: var(--text-2); margin-top: 10px; }
.mini-track { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); margin-top: 14px; overflow: hidden; }
.mini-track > i { display: block; height: 100%; border-radius: 6px; background: var(--primary); }

/* ==========================================================================
   表单
   ========================================================================== */
.form-group { margin-bottom: 16px; }
.form-group label, .form-label {
    display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text-2);
}

.form-control, .form-select, select.form-control {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text);
    background-color: #0a0f1a;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}
select.form-control, .form-select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2393a0b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}
.form-control::placeholder { color: var(--text-3); }
.form-control:focus, .form-select:focus {
    outline: none;
    color: var(--text);
    background-color: #0b1120;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.22);
}
.form-control[readonly] { background-color: rgba(255,255,255,.03); }
textarea.form-control { min-height: 96px; }
.page-tools .form-control { width: auto; flex: 0 1 auto; }
.page-tools input.form-control { width: 240px; }
.page-tools .toolbar-select { min-width: 130px; }
option { background: var(--surface-solid); color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: middle; }

.input-group { display: flex; gap: 8px; }
.input-group > .form-control { flex: 1; border-radius: var(--radius-sm) !important; }
.input-group > .btn { border-radius: var(--radius-sm) !important; }

.form-row { display: flex; gap: 16px; align-items: flex-start; }
.form-row > * { flex: 1; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.grid-span-2 { grid-column: 1 / -1; }

.rule-remark-input { min-height: 96px; resize: vertical; }
.rule-remark-cell { max-width: 240px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px;
    padding: 0 16px;
    font-size: 13.5px; font-weight: 500; line-height: 1.2;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, border-color .2s, transform .15s, box-shadow .2s, opacity .2s;
    font-family: inherit;
}
.btn:hover { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary-2); outline-offset: 2px; box-shadow: none; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 18px rgba(59,108,246,.25); }
.btn-primary:hover { background: #4a78ff; border-color: #4a78ff; color: #fff; }
.btn-secondary { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.btn-secondary:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-danger:hover { background: #f05a5f; border-color: #f05a5f; color: #fff; }
.btn-success { background: #1f9d6b; border-color: #1f9d6b; color: #fff; }
.btn-success:hover { background: #25b17a; color: #fff; }
.btn-warning { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-warning:hover { background: #ff8a3a; color: #fff; }
.btn-outline-secondary { background: transparent; border-color: var(--border-2); color: var(--text); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-ghost-danger { color: var(--danger); border-color: rgba(255,110,110,.35); background: transparent; }
.btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

/* ==========================================================================
   表格
   ========================================================================== */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 4px; }
th {
    background: transparent;
    color: #8592aa;
    font-weight: 500; font-size: 12px; text-align: left;
    padding: 12px 14px;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 13px 14px;
    color: #d7deea;
    font-size: 13.5px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.025); }
td .btn + .btn { margin-left: 4px; }

/* 状态文字 */
.text-success { color: var(--success) !important; font-weight: 500; }
.text-danger { color: var(--danger) !important; font-weight: 500; }
.text-warning { color: var(--warning) !important; font-weight: 500; }
.text-muted { color: var(--text-2) !important; }

.badge-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--success); background: var(--success-soft); }
.badge-off { color: var(--danger); background: var(--danger-soft); }
.badge-warn { color: var(--warning); background: var(--warning-soft); }
.badge-blue { color: var(--primary-2); background: var(--primary-soft); }

/* 统计胶囊（转发 / 用户页） */
.stats-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; flex: 0 1 auto; }
.stat-card {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 14px;
    display: inline-flex; align-items: center; gap: 8px;
    cursor: pointer; min-height: 38px;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}
.stat-card:hover { border-color: var(--border-2); }
.stat-card.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,108,246,.18); }
.stat-card-success .stat-value { color: var(--success); }
.stat-card-danger .stat-value { color: var(--danger); }
.stat-card-warning .stat-value { color: var(--warning); }
.stat-label { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.stat-value { color: var(--text); font-size: 15px; font-weight: 700; line-height: 1; }

/* ==========================================================================
   弹窗
   ========================================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(2, 4, 10, 0.66);
    backdrop-filter: blur(6px);
    display: flex; justify-content: center; align-items: center;
    padding: 16px;
    z-index: 1000;
    animation: fadeIn .2s ease-out;
}
.custom-modal {
    position: relative;
    width: 100%;
    max-width: 1000px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 24px;
    background: rgba(16, 22, 36, 0.97);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0,0,0,.5);
    color: var(--text);
    animation: slideUp .25s ease-out;
}
.custom-modal h3 { margin-bottom: 16px; font-size: 1.125rem; }
.custom-modal.modal-sm { max-width: 520px; }
.custom-modal.modal-md { max-width: 640px; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.modal-x {
    position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px;
    border: 0; background: transparent; color: var(--text-2); font-size: 20px; cursor: pointer;
}
.modal-x:hover { background: var(--surface-2); color: #fff; }

/* Bootstrap 弹窗 / 下拉（修改密码、API Key、用户菜单） */
.modal-content { background: rgba(16, 22, 36, 0.98); border: 1px solid rgba(255,255,255,.1); border-radius: 20px; color: var(--text); }
.modal-header, .modal-footer { border-color: var(--border); }
.dropdown-menu { background: var(--surface-solid); border: 1px solid var(--border-2); border-radius: 12px; padding: 6px; box-shadow: 0 20px 40px rgba(0,0,0,.45); }
.dropdown-item { color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: #fff; }
.dropdown-divider { border-color: var(--border); }

/* 表格里的“更多”菜单 */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
    display: none;
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 168px;
    padding: 6px;
    background: var(--surface-solid);
    border: 1px solid var(--border-2);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,.5);
    z-index: 1001;
}
.dropdown-content::before { content: ''; position: absolute; top: -10px; left: 0; width: 100%; height: 10px; }
.dropdown-content button {
    display: block; width: 100%; text-align: left;
    padding: 9px 12px; min-height: 38px;
    background: none; border: 0; border-radius: 8px;
    color: var(--text); font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.dropdown-content button:hover { background: var(--surface-2); }
.dropdown-content hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--border); }
@media (hover: hover) { .dropdown:hover .dropdown-content { display: block; } }
.dropdown.open .dropdown-content { display: block; }
.dropdown.drop-up .dropdown-content { top: auto; bottom: calc(100% + 6px); }

/* ==========================================================================
   进度条 / 任务
   ========================================================================== */
.track { height: 10px; border-radius: 10px; background: rgba(255,255,255,.07); overflow: hidden; }
.track > i {
    display: block; height: 100%; width: 0; border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    box-shadow: 0 0 14px rgba(80,140,255,.7);
    transition: width .4s ease;
}
.track.sm { height: 6px; }
.track.t-orange > i { background: linear-gradient(90deg, var(--orange), #f7b24b); box-shadow: 0 0 14px rgba(240,140,50,.65); }
.track.t-purple > i { background: linear-gradient(90deg, #6d4dff, var(--primary-2)); box-shadow: 0 0 14px rgba(110,100,255,.65); }
.track.t-red > i { background: linear-gradient(90deg, var(--danger-solid), #ff8a6a); box-shadow: 0 0 14px rgba(240,90,80,.6); }
.track.t-green > i { background: linear-gradient(90deg, #1f9d6b, var(--success)); box-shadow: 0 0 14px rgba(60,200,140,.55); }
.track.indeterminate > i { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

.job-modal { max-width: 560px; }
#job-body { display: flex; flex-direction: column; gap: 16px; }
#job-body .modal-actions { margin-top: 0; }
.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-right: 36px; }
.job-head h3 { margin: 0; }
.job-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.job-pct { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--primary-2); }
.job-pct.c-orange { color: #f7a24b; } .job-pct.c-red { color: var(--danger); } .job-pct.c-purple { color: #9d8bff; } .job-pct.c-green { color: var(--success); }

.steps { display: flex; flex-direction: column; gap: 10px; }
.st { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.st .dot {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,.06); color: var(--text-3);
}
.st .nm { flex: 1; color: var(--text-3); }
.st .nt { font-size: 12px; color: var(--text-2); text-align: right; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st.done .dot { background: var(--success-soft); color: var(--success); }
.st.done .nm { color: #c9d3e3; }
.st.run .dot { background: var(--primary); color: #fff; box-shadow: 0 0 14px rgba(80,140,255,.8); animation: pulse 1.4s ease-in-out infinite; }
.st.run .nm { color: #fff; font-weight: 600; }
.st.fail .dot { background: var(--danger-soft); color: var(--danger); }
.st.fail .nm { color: var(--danger); }
.st.skip .dot { background: rgba(255,255,255,.05); color: var(--text-3); }
.st.skip .nm { color: var(--text-2); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.2); }
@keyframes pulse { 50% { box-shadow: 0 0 4px rgba(80,140,255,.4); } }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; }
.kpi span { display: block; font-size: 12px; color: var(--text-2); }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }

.logbox {
    background: #05080f; border: 1px solid rgba(255,255,255,.06); border-radius: 12px;
    padding: 10px 12px; height: 120px; overflow: auto;
    font: 12px/1.7 var(--mono); color: #8fa0bd; white-space: pre-wrap; word-break: break-all;
}
.result-box { border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.result-ok { background: var(--success-soft); color: var(--success); border: 1px solid rgba(52,211,153,.25); }
.result-fail { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(248,113,113,.25); }
.tip-warn { font-size: 12.5px; color: #f7c56b; background: var(--warning-soft); border: 1px solid rgba(245,170,60,.25); border-radius: 10px; padding: 10px 12px; }
.tip-info { font-size: 12.5px; color: #a9c6ff; background: var(--primary-soft); border: 1px solid rgba(80,140,255,.25); border-radius: 10px; padding: 10px 12px; }

/* 页面上的“后台任务”区和右下角浮动任务条 */
.job-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.job-item {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); border-radius: 14px;
    padding: 12px 14px; cursor: pointer; text-align: left; color: var(--text); font-family: inherit; width: 100%;
}
.job-item:hover { border-color: var(--border-2); }
.job-item .row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 8px; }
.job-item .row1 b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-item .row2 { font-size: 12px; color: var(--text-2); margin-top: 6px; }

#job-dock {
    position: fixed; right: 20px; bottom: 20px; z-index: 900;
    width: 320px; max-width: calc(100vw - 24px);
    display: flex; flex-direction: column; gap: 8px;
}
#job-dock .job-item { background: rgba(16, 22, 36, .96); border-color: rgba(80,140,255,.35); box-shadow: 0 16px 40px rgba(0,0,0,.45); backdrop-filter: blur(10px); }

.cell-progress { width: 150px; }
.cell-progress .lbl { font-size: 12px; color: var(--primary-2); margin-bottom: 6px; white-space: nowrap; }

/* Toast */
#toast-wrap { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-msg {
    pointer-events: auto; padding: 10px 16px; border-radius: 12px; font-size: 13.5px;
    background: rgba(16,22,36,.97); border: 1px solid var(--border-2); color: var(--text);
    box-shadow: 0 16px 40px rgba(0,0,0,.45); animation: slideDown .25s ease-out; max-width: 90vw;
}
.toast-msg.ok { border-color: rgba(52,211,153,.4); }
.toast-msg.err { border-color: rgba(248,113,113,.45); color: #ffb0b0; }

/* 删除服务器：两个选项 */
.opt {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px; border-radius: 14px; cursor: pointer;
    border: 1px solid var(--border); background: rgba(255,255,255,.03);
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.opt + .opt { margin-top: 12px; }
.opt input[type="radio"] { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.opt .opt-title { font-size: 15px; font-weight: 600; }
.opt .opt-desc { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.opt .opt-extra { margin-top: 8px; font-size: 13px; color: #c9d3e3; display: flex; gap: 8px; align-items: center; }
.opt.on { border-color: var(--primary); background: rgba(59,108,246,.1); box-shadow: 0 0 0 1px var(--primary) inset; }
.opt.on-red { border-color: var(--danger-solid); background: rgba(229,72,77,.08); box-shadow: 0 0 0 1px var(--danger-solid) inset; }
.opt.on-red .opt-title { color: #ff9a9a; }

/* 导入预览 */
.counts-line { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; margin: 12px 0; }
.c-ok { color: var(--success); } .c-warn { color: var(--warning); } .c-bad { color: var(--danger); }
.scroll-box { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
.scroll-box table { margin: 0; }
.scroll-box th { position: sticky; top: 0; background: #111827; z-index: 1; }

/* ==========================================================================
   登录页
   ========================================================================== */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card .brand-mark { margin: 0 auto 14px; width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, var(--primary), #7c4dff); box-shadow: 0 0 24px rgba(59,108,246,.5); }
.auth-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.auth-card .btn { min-height: 46px; font-size: 15px; }

/* ==========================================================================
   原有模块的附加样式（显示分组 / 攻击告警）—— 换成深色
   ========================================================================== */
.dg-modal { max-width: 900px; }
.dg-x { position: absolute; right: 16px; top: 14px; border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--text-2); width: 36px; height: 36px; border-radius: 10px; }
.dg-x:hover { background: var(--surface-2); color: #fff; }
.dg-table { width: 100%; margin: 1rem 0; }
.dg-table td, .dg-table th { vertical-align: top; }
.dg-domain { font-family: var(--mono); }
.dg-small { font-size: 12.5px; }
.dg-ids { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.dg-tip { margin: .5rem 0; padding: .6rem .8rem; border-radius: 10px; background: var(--primary-soft); color: #a9c6ff; font-size: 13px; }
.dg-warn { background: var(--warning-soft); color: #f7c56b; }
.dg-form { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed rgba(255,255,255,.14); }
.dg-form h4 { font-size: 1rem; margin-bottom: .75rem; }
.dg-link { font-size: 12px; }
.dg-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.dg-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px; border-radius: 999px; background: var(--primary-soft); color: #a9c6ff; font-size: 12px; }
.dg-chip i { font-style: normal; cursor: pointer; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 50%; color: var(--primary-2); }
.dg-chip i:hover { background: var(--danger-solid); color: #fff; }
.dg-quick { display: flex; gap: 6px; align-items: center; }
.dg-quick .btn { flex: none; white-space: nowrap; }
.dg-quick .form-control { padding: 4px 8px; font-size: 12.5px; min-height: 34px; }

.al-btn { color: #ff9a9a; border-color: rgba(255,110,110,.35); background: rgba(229,72,77,.08); }
.al-btn:hover { background: rgba(229,72,77,.18); color: #ffc2c2; border-color: rgba(255,110,110,.5); }
.al-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff; background: var(--danger-solid); animation: alBlink 1s ease-in-out infinite; }
.al-on td { background: rgba(229,72,77,.07); }
.al-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger-solid); margin-right: 6px; animation: alBlink 1s ease-in-out infinite; }
@keyframes alBlink { 50% { opacity: .35; } }

/* ==========================================================================
   工具类
   ========================================================================== */
.text-center { text-align: center; }
.d-none { display: none !important; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mr-2 { margin-right: .5rem; }
.d-grid { display: grid; }
.gap-2 { gap: .5rem; }
.mono { font-family: var(--mono); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

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

/* ==========================================================================
   平板
   ========================================================================== */
@media (max-width: 1100px) {
    .dash-hero { grid-column: span 1; }
}

/* ==========================================================================
   手机（≤ 768px）
   ========================================================================== */
@media (max-width: 768px) {
    body { font-size: 14px; background-attachment: scroll; }
    .sidebar { display: none; }
    .topbar { padding: 14px 14px 0; }
    .topbar .greet-name { font-size: 18px; }
    .topbar .user-menu { display: block; }
    .container, #main-content { padding: 12px 12px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }

    .tabbar {
        display: flex;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 800;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(10, 14, 24, 0.94);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(14px);
    }
    .tabbar .side-link { flex: 1; width: auto; min-height: var(--tabbar-h); border-radius: 0; background: transparent !important; box-shadow: none !important; font-size: 11px; }
    .tabbar .side-link.active { color: var(--primary-2); }

    .card { padding: 16px; border-radius: 16px; margin-bottom: 14px; }
    .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .page-header > div[style*="display:flex"], .page-header > div[style*="display: flex"] { flex-wrap: wrap; }
    .page-tools { justify-content: stretch; }
    .page-tools .form-control, .page-tools input.form-control, .page-tools .toolbar-select, .page-tools .btn { width: 100%; max-width: none !important; flex: 1 1 100%; }
    .page-header > * { min-width: 0; max-width: 100%; }
    .stats-grid { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; max-width: 100%; }
    .stat-card { flex: none; }

    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .dash-hero { grid-column: 1 / -1; min-height: 130px; }
    .dash-num { font-size: 26px; }

    .grid-2 { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .form-row > * { width: 100%; }

    /* 表格 → 卡片 */
    table.cardify, table.cardify tbody, table.cardify tr, table.cardify td { display: block; width: 100%; }
    table.cardify thead { display: none; }
    table.cardify tr {
        background: rgba(255,255,255,.035);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 10px 14px;
        margin-bottom: 10px;
    }
    table.cardify tr:hover td { background: transparent; }
    table.cardify td {
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
        padding: 7px 0; border: 0; text-align: right; min-height: 34px;
        word-break: break-word;
    }
    table.cardify td::before {
        content: attr(data-label);
        flex: none; color: var(--text-2); font-size: 12.5px; text-align: left;
    }
    table.cardify td[data-label=""]::before { content: none; }
    table.cardify td.cell-full, table.cardify td[colspan] { display: block; text-align: center; }
    table.cardify td.cell-full::before, table.cardify td[colspan]::before { content: none; }
    table.cardify td.cell-actions {
        display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px;
        border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px;
    }
    table.cardify td.cell-actions::before { content: none; }
    table.cardify td.cell-actions > * { flex: 1 1 auto; }
    table.cardify td.cell-actions .btn { min-height: 40px; width: 100%; }
    table.cardify td.cell-actions > div { display: flex !important; flex-wrap: wrap; gap: 8px !important; width: 100%; }
    table.cardify td.cell-actions > div > * { flex: 1 1 30%; }
    table.cardify td.cell-actions .dropdown { display: block; }
    table.cardify td.cell-actions .dropdown > .btn { width: 100%; }
    table.cardify td.cell-actions .dropdown-content { right: 0; left: auto; }
    table.cardify td .btn + .btn { margin-left: 0; }
    table.cardify td.cell-title { font-size: 15px; font-weight: 600; color: var(--text); }
    .rule-remark-cell { max-width: none; }

    /* 弹窗 → 底部弹层 */
    .modal-overlay { align-items: flex-end; padding: 0; }
    .custom-modal, .custom-modal.modal-sm, .custom-modal.modal-md, .job-modal {
        max-width: 100%; width: 100%;
        max-height: 92vh;
        border-radius: 22px 22px 0 0;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
        animation: sheetUp .28s ease-out;
    }
    .custom-modal::before {
        content: ''; display: block; width: 40px; height: 5px; border-radius: 5px;
        background: rgba(255,255,255,.2); margin: -6px auto 12px;
    }
    .modal-actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 16px -16px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(16,22,36,.98); border-top: 1px solid var(--border); }
    .modal-actions .btn { flex: 1 1 0; min-height: 46px; }
    .modal-actions .btn[style*="float"] { float: none !important; }
    .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; }
    .modal-content { border-radius: 22px 22px 0 0; }

    .kpis { gap: 8px; }
    .kpi b { font-size: 18px; }
    .job-pct { font-size: 28px; }

    #job-dock { left: 12px; right: 12px; width: auto; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
    #job-dock .job-item:not(:first-child) { display: none; }

    .btn { min-height: 42px; }
    .btn-sm { min-height: 36px; }
    .dropdown-content button { min-height: 44px; }
}

@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 转发列表分页 */
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.pager-info { font-size: 13px; color: var(--text-2); }
.pager-info b { color: var(--text); }
.pager-ctrl { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pager-ctrl .btn-sm { min-width: 36px; padding: 0 10px; }
.pager-ctrl .pager-size { width: auto; min-height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.pager-gap { color: var(--text-3); padding: 0 4px; }
@media (max-width: 768px) {
    .pager { flex-direction: column; align-items: stretch; }
    .pager-ctrl { justify-content: center; }
    .pager-ctrl .pager-size { flex: 1 1 100%; }
}

/* 显示分组页面：服务器切换 */
.dg-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.dg-tab { min-height: 40px; }
.dg-tab-n { font-size: 11.5px; opacity: .75; margin-left: 4px; font-weight: 400; }
.dg-tab-dead { color: #f7c56b; border-color: rgba(245,170,60,.35); background: var(--warning-soft); }
.dg-tab-dead.active { box-shadow: 0 0 0 2px rgba(245,170,60,.5) inset; }
#groups-page .dg-table th { position: static; }

/* 用户状态原因 */
.st-reason { display: block; font-size: 11.5px; color: var(--text-2); margin-top: 3px; font-weight: 400; }
@media (max-width: 768px) {
    .tabbar .side-link { font-size: 10.5px; }
    .dg-tab { flex: 1 1 calc(50% - 8px); }
}
