/* ========== 全局样式 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f5f7fb;
    color: #1f2937;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }

/* ========== 导航 ========== */
.navbar {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 14px 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
}
.navbar h1 { font-size: 20px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.navbar .logo { font-size: 24px; }
.navbar nav a {
    display: inline-block; padding: 6px 16px; border-radius: 8px;
    margin-left: 10px; font-size: 14px; opacity: .9; transition: .2s;
}
.navbar nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
.navbar nav a.active { background: rgba(255,255,255,.22); }

/* ========== 容器 ========== */
.container { max-width: 1280px; margin: 30px auto; padding: 0 24px; }
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px;
}
.page-header h2 { font-size: 22px; color: #111827; }
.subtitle { color: #6b7280; font-size: 13px; margin-top: 4px; }

/* ========== 卡片 ========== */
.card {
    background: #fff; border-radius: 14px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    margin-bottom: 24px;
}
.card-title {
    font-size: 16px; font-weight: 600; margin-bottom: 18px;
    padding-bottom: 12px; border-bottom: 1px solid #f0f2f7;
    display: flex; align-items: center; gap: 8px;
}
.card-title .icon { font-size: 18px; }

/* ========== 表单 ========== */
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-bottom: 18px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-group { display: flex; flex-direction: column; }
.form-group label {
    font-size: 13px; color: #374151; margin-bottom: 6px; font-weight: 500;
}
.form-group .hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
input[type="text"], input[type="number"], input[type="time"],
input[type="datetime-local"], select, textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #d1d5db;
    border-radius: 8px; font-size: 14px; outline: none; transition: .2s;
    background: #fff; color: #111;
}
input:focus, select:focus, textarea:focus {
    border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ========== 时间段设置 ========== */
.time-setting { display: flex; gap: 12px; align-items: flex-end; }
.time-unit { display: flex; flex-direction: column; flex: 1; }
.time-unit input { text-align: center; font-family: Consolas, monospace; }
.time-sep { font-size: 20px; color: #6b7280; padding-bottom: 9px; }

/* ========== 标签 / Chips ========== */
.chip-group {
    display: flex; flex-wrap: wrap; gap: 8px; padding: 8px;
    border: 1px dashed #d1d5db; border-radius: 8px; min-height: 46px;
    background: #fafbff;
}
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; background: #eef2ff; color: #4338ca;
    border-radius: 999px; font-size: 13px; cursor: pointer;
    border: 1px solid #c7d2fe;
}
.chip:hover { background: #e0e7ff; }
.chip .remove { font-weight: bold; opacity: .7; }
.chip.add-new {
    background: #fff; border-style: dashed; color: #6366f1; cursor: pointer;
}
.chip-input {
    border: none; background: transparent; outline: none;
    font-size: 13px; min-width: 120px; padding: 0;
}

/* ========== 开关 / 复选框 ========== */
.switch-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.switch {
    position: relative; display: inline-block; width: 44px; height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #d1d5db; transition: .3s; border-radius: 24px;
}
.slider::before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff;
    transition: .3s; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
input:checked + .slider { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
input:checked + .slider::before { transform: translateX(20px); }

.checkbox-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.checkbox-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 10px;
    cursor: pointer; transition: .2s; background: #fafafa;
}
.checkbox-item:hover { background: #f3f4f6; }
.checkbox-item.checked {
    background: #eef2ff; border-color: #818cf8;
    box-shadow: inset 0 0 0 1px #6366f1;
}
.checkbox-item input[type="checkbox"] {
    width: 18px; height: 18px; accent-color: #6366f1;
}
.platform-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 500;
}
.platform-label .emoji { font-size: 18px; }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 9px 20px; border-radius: 9px;
    border: none; cursor: pointer; font-size: 14px; font-weight: 500;
    transition: .2s; white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
    box-shadow: 0 2px 6px rgba(99,102,241,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(99,102,241,.45); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-success {
    background: linear-gradient(135deg, #10b981, #059669); color: #fff;
    box-shadow: 0 2px 6px rgba(16,185,129,.3);
}
.btn-success:hover { transform: translateY(-1px); }
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff;
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-default {
    background: #fff; color: #374151; border: 1px solid #d1d5db;
}
.btn-default:hover { background: #f3f4f6; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ========== 配置列表 ========== */
.config-list { display: flex; flex-direction: column; gap: 14px; }
.config-item {
    border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px;
    transition: .2s; background: #fff;
}
.config-item:hover { border-color: #c7d2fe; box-shadow: 0 4px 12px rgba(0,0,0,.05); }
.config-item.active {
    border-color: #6366f1; background: linear-gradient(to right, #fff, #eef2ff);
}
.config-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.config-name {
    font-size: 16px; font-weight: 600; color: #111827;
    display: flex; align-items: center; gap: 10px;
}
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 500;
}
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.config-meta {
    display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: #6b7280;
}
.config-meta span { display: inline-flex; align-items: center; gap: 5px; }
.config-actions { display: flex; gap: 8px; }

/* ========== 任务进度 ========== */
.task-status {
    display: inline-block; padding: 2px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 500;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-running { background: #dbeafe; color: #1e40af; animation: pulse 1.5s infinite; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #991b1b; }
@keyframes pulse { 0%,100% { opacity: 1;} 50% { opacity: .6;} }

/* 失败原因提示图标：鼠标悬停显示完整 error_msg */
.task-err-tip {
    display: inline-block; margin-left: 6px; cursor: help;
    color: #dc2626; font-size: 13px; font-weight: 700; vertical-align: middle;
}

.progress-bar {
    width: 100%; height: 8px; background: #e5e7eb; border-radius: 999px;
    overflow: hidden; margin: 10px 0;
}
.progress-inner {
    height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width .4s;
}

/* ========== 结果表格 ========== */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}
.filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input { max-width: 180px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
    padding: 12px 10px; text-align: left;
    border-bottom: 1px solid #f0f2f7;
    vertical-align: top;
}
.data-table th {
    background: #f9fafb; color: #374151; font-weight: 600;
    position: sticky; top: 0; z-index: 1;
}
.data-table tr:hover { background: #fafbff; }
.data-table .title-cell {
    max-width: 260px; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.data-table .title-cell a { color: #4338ca; }
.data-table .title-cell a:hover { text-decoration: underline; }
.badge-platform {
    padding: 2px 8px; border-radius: 4px; font-size: 12px;
}
.platform-wechat { background: #e0f2fe; color: #075985; }
.platform-douyin { background: #fce7f3; color: #9d174d; }
.platform-xiaohongshu { background: #fee2e2; color: #991b1b; }
.platform-weibo { background: #fee2e2; color: #dc2626; }
.platform-tencent { background: #e0f2fe; color: #0c4a6e; }
.platform-toutiao { background: #ffedd5; color: #c2410c; }

.badge-type { padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.type-article { background: #d1fae5; color: #065f46; }
.type-video { background: #fed7aa; color: #9a3412; }
.type-live { background: #fecaca; color: #991b1b; }
.type-image { background: #dbeafe; color: #1e40af; }

.badge-filter { padding: 2px 8px; border-radius: 4px; font-size: 11px; }
.filtered-yes { background: #fee2e2; color: #991b1b; }
.filtered-no { background: #d1fae5; color: #065f46; }

.thumbnail {
    width: 60px; height: 60px; object-fit: cover; border-radius: 6px;
    background: #f3f4f6;
}

/* ========== 分页 ========== */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 20px; font-size: 13px; color: #6b7280;
}
.page-buttons { display: flex; gap: 6px; }
.page-btn {
    padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    background: #fff; cursor: pointer;
}
.page-btn:hover { background: #f3f4f6; }
.page-btn.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ========== 弹窗 ========== */
.modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 999; padding: 20px;
}
.modal {
    background: #fff; border-radius: 16px; width: 100%;
    max-width: 800px; max-height: 90vh; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    padding: 18px 24px; border-bottom: 1px solid #f0f2f7;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 18px; }
.modal-close {
    font-size: 24px; cursor: pointer; color: #6b7280;
    background: none; border: none;
}
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 14px 24px; border-top: 1px solid #f0f2f7;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ========== Toast ========== */
.toast-container {
    position: fixed; top: 80px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    padding: 12px 18px; border-radius: 10px; color: #fff;
    font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
    animation: slideIn .3s;
}
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #3b82f6; }
.toast-warning { background: #f59e0b; }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0;}
    to { transform: translateX(0); opacity: 1;}
}

/* ========== 空状态 ========== */
.empty-state {
    padding: 60px 20px; text-align: center; color: #9ca3af;
}
.empty-state .icon { font-size: 50px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .form-row, .form-row.cols-3, .form-row.cols-4 {
        grid-template-columns: 1fr;
    }
    .checkbox-list { grid-template-columns: 1fr; }
    .navbar { padding: 14px 16px; flex-direction: column; gap: 10px; }
    .container { padding: 0 16px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 6px; }
}


/* ========== 平台登录状态卡片 ========== */
.login-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  transition: .2s;
}
.login-card.unsaved { border-color:#fcd34d; background:#fffbeb; }
.login-card.saved { border-color:#86efac; background:#f0fdf4; }
.login-card.expired { border-color:#fca5a5; background:#fef2f2; }
.login-card.no-login { opacity:0.85; background:#f8fafc; }
.login-card-head {
  display:flex; align-items:center; gap:12px; margin-bottom:12px;
}
.plat-emoji { font-size:28px; }
.plat-name { font-size:16px; font-weight:700; }
.plat-sub { font-size:12px; color:#6b7280; }
.login-card-head { justify-content: space-between; }
.badge {
  display:inline-block; padding:3px 10px; border-radius:9999px;
  font-size:12px; font-weight:600;
}
.badge-success { background:#16a34a; color:#fff; }
.badge-warn    { background:#d97706; color:#fff; }
.badge-info    { background:#2563eb; color:#fff; }
.badge-danger  { background:#dc2626; color:#fff; }
.login-card-expired-tip { color:#b91c1c; font-weight:600; line-height:1.5; }

.login-card-body { margin:6px 0 10px; }
.stat-line { font-size:13px; color:#4b5563; margin:5px 0; display:flex; gap:8px; align-items:flex-start; line-height:1.5; }
.stat-line span:first-child { color:#6b7280; min-width:66px; flex-shrink:0; }

.login-card-actions {
  display:flex; flex-wrap:wrap; gap:8px;
  border-top:1px dashed #e5e7eb; padding-top:12px; margin-top:8px;
}
