/* ===== 测压 · 清蓝净白 全新视觉 (v2026-09-13 全面换新, 浅色系) ===== */
:root {
    --bg: #edf4fb;
    --panel: #ffffff;
    --panel-2: #f7fafd;
    --line: #e3ecf6;
    --line-2: #d2e0ef;
    --txt: #1b2a3c;
    --mut: #5b6d81;
    --mut-2: #8da2b8;
    --sky: #0ea5e9;
    --sky-deep: #0284c7;
    --teal: #14b8a6;
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --violet: #8b5cf6;
    --shadow: 0 1px 2px rgba(23, 43, 77, .04), 0 8px 24px rgba(23, 43, 77, .06);
    --shadow-hover: 0 2px 4px rgba(23, 43, 77, .05), 0 14px 36px rgba(14, 165, 233, .15);
    --ring: 0 0 0 3px rgba(14, 165, 233, .15);
    --radius: 16px;
    --radius-sm: 11px;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}

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

/* ===== 满屏水印 (稀疏, 淡蓝) ===== */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='640' height='420'><text x='160' y='110' font-size='20' fill='%230ea5e9' font-family='sans-serif' font-weight='600' transform='rotate(-20 160 110)' text-anchor='middle'>%40box520</text><text x='480' y='230' font-size='20' fill='%230ea5e9' font-family='sans-serif' font-weight='600' transform='rotate(-14 480 230)' text-anchor='middle'>%40box520</text><text x='320' y='350' font-size='20' fill='%230ea5e9' font-family='sans-serif' font-weight='600' transform='rotate(-20 320 350)' text-anchor='middle'>%40box520</text></svg>");
    background-size: 640px 420px;
    background-repeat: repeat;
}

/* ===== 侧边栏频道标签 ===== */
.channel-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #e0f4ff, #dcfaf5);
    border: 1px solid #bfe6f8;
    color: #0369a1;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 2px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(14, 165, 233, .12);
    animation: tagBreath 4s ease-in-out infinite;
}
@keyframes tagBreath {
    0%, 100% { box-shadow: 0 4px 14px rgba(14, 165, 233, .10); }
    50% { box-shadow: 0 6px 22px rgba(14, 165, 233, .22); }
}

body {
    font-family: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background:
        radial-gradient(860px 420px at 90% -140px, rgba(14, 165, 233, .10), transparent 62%),
        radial-gradient(720px 400px at -6% 112%, rgba(20, 184, 166, .08), transparent 60%),
        var(--bg);
    color: var(--txt);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== 布局 ===== */
.container { display: flex; min-height: 100vh; }

/* ===== 侧边栏 (浅色新风格) ===== */
.sidebar {
    width: 230px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    padding: 24px 16px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 20px;
}
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--sky), var(--teal));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    color: #fff;
    box-shadow: 0 6px 16px rgba(14, 165, 233, .35);
    transition: transform .35s var(--ease), box-shadow .35s ease;
}
.logo:hover .logo-icon { transform: rotate(-8deg) scale(1.06); box-shadow: 0 8px 22px rgba(14, 165, 233, .5); }
.logo span { font-size: 15.5px; font-weight: 800; letter-spacing: .5px; color: var(--txt); }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--mut);
    text-decoration: none;
    font-size: 14px;
    position: relative;
    border: 1px solid transparent;
    transition: background .25s ease, color .25s ease, border-color .25s ease, transform .25s var(--ease);
}
.nav-item i { width: 20px; text-align: center; transition: transform .3s var(--ease), color .25s ease; }
.nav-item:hover { background: #eef7fe; color: var(--sky-deep); border-color: #d8ecfb; transform: translateX(2px); }
.nav-item:hover i { transform: scale(1.15); }
.nav-item.active {
    background: linear-gradient(135deg, #e2f4ff, #e2faf5);
    border-color: #bfe6f8;
    color: #0369a1;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(14, 165, 233, .12);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px; top: 50%;
    width: 3px; height: 22px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--sky), var(--teal));
    transform: translateY(-50%);
    box-shadow: 0 0 10px rgba(14, 165, 233, .6);
    animation: navBar .3s var(--ease) both;
}
@keyframes navBar { from { height: 0; opacity: 0; } to { height: 22px; opacity: 1; } }

.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--line); }
.status-indicator {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--mut);
}
.dot {
    width: 8px; height: 8px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); }
    50% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* ===== 主内容 ===== */
.main-content {
    flex: 1;
    margin-left: 230px;
    padding: 32px 36px;
    max-width: 1100px;
}
.page { display: none; }
.page.active { display: block; }
/* 页面切换: 顶层元素依次浮现 */
.page.active > * { animation: rise .4s var(--ease) both; }
.page.active > *:nth-child(1) { animation-delay: .00s; }
.page.active > *:nth-child(2) { animation-delay: .05s; }
.page.active > *:nth-child(3) { animation-delay: .10s; }
.page.active > *:nth-child(4) { animation-delay: .15s; }
.page.active > *:nth-child(5) { animation-delay: .20s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.page-header { margin-bottom: 18px; }
.page-header h1 {
    font-size: 25px; font-weight: 800; letter-spacing: .5px;
    background: linear-gradient(120deg, var(--sky-deep) 0%, var(--sky) 45%, var(--teal) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.page-header p { color: var(--mut); font-size: 13.5px; margin-top: 4px; }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    transition: transform .3s var(--ease), box-shadow .3s ease, border-color .3s ease;
    cursor: default;
    position: relative;
    overflow: hidden;
}
/* 顶部渐彩条 */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sky), var(--teal));
    opacity: .75;
}
.stat-card.pending::before { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.stat-card.running::before { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.stat-card.completed::before { background: linear-gradient(90deg, #34d399, var(--green)); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #cfe6f7; }
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-5deg); }
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    color: var(--sky-deep);
    background: linear-gradient(135deg, #e0f2fe, #ecfeff);
    border: 1px solid #c9e8fa;
    flex-shrink: 0;
    transition: transform .35s var(--ease);
}
.stat-card.pending .stat-icon { color: #b45309; background: linear-gradient(135deg, #fef3c7, #fffbeb); border-color: #fde68a; }
.stat-card.running .stat-icon { color: #1d4ed8; background: linear-gradient(135deg, #dbeafe, #eff6ff); border-color: #bfdbfe; }
.stat-card.completed .stat-icon { color: #047857; background: linear-gradient(135deg, #d1fae5, #ecfdf5); border-color: #a7f3d0; }
/* "等待执行"卡片可点击 */
.stat-card.pending:hover { border-color: #fcd34d; box-shadow: 0 2px 4px rgba(23,43,77,.05), 0 14px 36px rgba(245, 158, 11, .18); }
.stat-card.pending:active { transform: translateY(-1px) scale(.985); }
.stat-card.pending .stat-icon { animation: breath 3.2s ease-in-out infinite; }
@keyframes breath { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } 50% { box-shadow: 0 0 0 7px rgba(245, 158, 11, .13); } }
.stat-info { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--mut); letter-spacing: .3px; }
.stat-value {
    font-size: 27px; font-weight: 800; line-height: 1.25;
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    color: var(--txt);
}

/* ===== 区块卡片 ===== */
.recent-tasks, .upcoming-tasks, .form-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.recent-tasks h2, .upcoming-tasks h3, .form-card h3 {
    font-size: 15.5px;
    margin-bottom: 15px;
    color: var(--txt);
    display: flex; align-items: center; gap: 8px;
    letter-spacing: .3px;
}
.recent-tasks h2 i, .upcoming-tasks h3 i, .form-card h3 i { color: var(--sky); }

/* ===== 任务列表 ===== */
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-item {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 13px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s var(--ease), background .25s ease;
}
.task-item:hover {
    border-color: #a5d8f5;
    background: #fff;
    box-shadow: 0 8px 24px rgba(14, 165, 233, .10);
    transform: translateY(-1px);
}
.task-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.task-phone { font-size: 14.5px; font-weight: 700; font-family: var(--mono); letter-spacing: .3px; }
.task-phone i { color: var(--sky); margin-right: 6px; }
.task-time { font-size: 11.5px; color: var(--mut-2); font-family: var(--mono); }
.task-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 112px; }

/* 列表入场/新任务动效 */
.task-item.t-enter { animation: tEnter .4s var(--ease) both; }
@keyframes tEnter { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.task-item.t-flash { animation: tFlash 1.5s ease both; }
@keyframes tFlash {
    0% { background: #e0f4ff; border-color: #7dd3fc; box-shadow: 0 0 0 4px rgba(14, 165, 233, .1); }
    100% { background: var(--panel-2); border-color: var(--line); box-shadow: none; }
}

.badge {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 11px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: .3px;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-pending { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-running { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-running::before { animation: pulse 1.4s infinite; }
.badge-completed { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.badge-failed { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

.progress-bar {
    width: 112px; height: 6px;
    background: #e6eef7;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sky-deep), var(--teal));
    border-radius: 3px;
    transition: width .5s var(--ease);
    position: relative;
}
/* 执行中的进度条: 流光 */
.progress-bar.running .progress-fill { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.progress-bar.running .progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .8) 50%, transparent 70%);
    background-size: 220% 100%;
    animation: shine 1.3s linear infinite;
    border-radius: 3px;
}
@keyframes shine { from { background-position: 160% 0; } to { background-position: -60% 0; } }

.task-actions button {
    background: none; border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    opacity: .6;
    transition: opacity .2s ease, transform .2s var(--ease);
}
.task-actions button:hover { opacity: 1; transform: scale(1.14); }

.empty-state {
    text-align: center;
    padding: 40px 0;
    color: #a9bccf;
}
.empty-state i { font-size: 34px; margin-bottom: 8px; display: block; animation: floatY 3s ease-in-out infinite; }
.empty-state p { font-size: 13.5px; }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ===== 模式切换 Tab ===== */
.mode-tabs { display: flex; gap: 8px; margin: 4px 0 16px; }
.mode-tab {
    flex: 1;
    padding: 10px 0;
    border: 1.5px solid var(--line-2);
    border-radius: 10px;
    background: #fff;
    color: var(--mut);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .25s ease, color .25s ease, background .25s ease, box-shadow .25s ease, transform .15s var(--ease);
    font-family: inherit;
}
.mode-tab:hover { border-color: #a5d8f5; color: var(--sky-deep); }
.mode-tab:active { transform: scale(.975); }
.mode-tab.active {
    border-color: transparent;
    background: linear-gradient(135deg, var(--sky), var(--teal));
    color: #fff;
    box-shadow: 0 6px 16px rgba(14, 165, 233, .3);
}
.btn-block { width: 100%; }

/* ===== 表单 ===== */
.schedule-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .schedule-form { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 12px; }
.form-group label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--mut);
    margin-bottom: 8px;
    letter-spacing: .3px;
}
.form-group label i { color: var(--sky); }
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--line-2);
    border-radius: 10px;
    font-size: 13px;
    font-family: var(--mono);
    background: var(--panel-2);
    color: var(--txt);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
    outline: none;
}
.form-group input::placeholder { color: var(--mut-2); font-family: system-ui, 'Microsoft YaHei', sans-serif; }
.form-group input:focus {
    border-color: var(--sky);
    background: #fff;
    box-shadow: var(--ring);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
    transition: transform .16s var(--ease), box-shadow .25s ease, filter .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
    background: linear-gradient(135deg, var(--sky), #38bdf8);
    color: #fff;
    box-shadow: 0 6px 16px rgba(14, 165, 233, .32);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(14, 165, 233, .42); transform: translateY(-1px); }
.btn-success {
    background: linear-gradient(135deg, var(--green), #34d399);
    color: #fff;
    box-shadow: 0 6px 16px rgba(16, 185, 129, .32);
}
.btn-success:hover { box-shadow: 0 8px 22px rgba(16, 185, 129, .42); transform: translateY(-1px); }
.btn-danger {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.btn-danger:hover { opacity: .88; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-outline {
    background: #fff;
    border: 1.5px solid var(--line-2);
    color: var(--txt);
}
.btn-outline:hover { border-color: var(--sky); color: var(--sky-deep); }

/* ===== 历史控制 ===== */
.history-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

/* ===== 列表滚动条 (细) ===== */
.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-thumb { background: #cfe0f0; border-radius: 99px; }
.task-list::-webkit-scrollbar-thumb:hover { background: #93c5fd; }

/* ===== 弹窗动效 ===== */
#pending-modal { animation: maskIn .22s ease both; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
#pending-modal > div { animation: pmIn .32s var(--ease) both; }
@keyframes pmIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; padding: 20px 8px; }
    .logo span, .nav-item span, .status-indicator { display: none; }
    .sidebar-footer { display: none; }
    .channel-tag { font-size: 12px; padding: 8px 12px; letter-spacing: 1px; margin-bottom: 14px; }
    .logo { justify-content: center; padding: 8px 0 20px; }
    .logo-icon { width: 36px; height: 36px; font-size: 15px; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-item.active::before { display: none; }
    .nav-item i { width: auto; }
    .main-content { margin-left: 60px; padding: 20px 14px; }
    .page-header h1 { font-size: 21px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 38px; height: 38px; font-size: 15px; border-radius: 11px; }
    .stat-value { font-size: 21px; }
    .stat-label { font-size: 11.5px; }
    .task-item { flex-direction: column; align-items: flex-start; }
    .task-status { align-items: flex-start; width: 100%; }
    .progress-bar { width: 100%; }
    .form-row { flex-direction: column; gap: 0; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
    .schedule-form { grid-template-columns: 1fr; }
    .history-controls { flex-wrap: wrap; }
    .history-controls .btn { flex: 1; min-width: 120px; }
}

@media (max-width: 480px) {
    .main-content { padding: 16px 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 12px; }
    .stat-icon { width: 33px; height: 33px; font-size: 13px; }
    .stat-value { font-size: 19px; }
    .recent-tasks, .upcoming-tasks, .form-card { padding: 14px; }
    .btn { padding: 11px 14px; font-size: 13px; }
    .task-item { padding: 12px; }
}

/* 历史任务/任务与结果: 固定高度纵向滚动, 滚到底加载更多(省带宽) */
.task-list#recent-tasks { max-height: 430px; overflow-y: auto; }
.task-list#upcoming-tasks { max-height: 430px; overflow-y: auto; }
.load-more-hint { text-align: center; color: var(--mut-2); font-size: 12px; padding: 8px 0 2px; font-family: var(--mono); }

/* ===== 减弱动效偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
