/* =====================================================================
   抖音代发视频监测系统 - 现代极简风格（黑白灰 + 品牌色点缀）
   ===================================================================== */
:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #17181a;
    --text-2: #5f6672;
    --text-3: #9aa1ac;
    --line: #e9ebef;
    --brand: #fe2c55;          /* 品牌红，克制使用 */
    --ok: #16a34a;
    --ok-bg: #ecfdf3;
    --bad: #dc2626;
    --bad-bg: #fef2f2;
    --warn: #d97706;
    --warn-bg: #fffbeb;
    --gray-bg: #f3f4f6;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
    --sidebar-w: 216px;
}

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

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, #f7f8fa 0%, #f2f3f6 100%) fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: .01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.flex1 { flex: 1; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--text-3); text-align: center; padding: 28px 0; }

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

.sidebar {
    width: var(--sidebar-w);
    background: #101114;
    color: #d1d5db;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 22px 20px 18px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 2px 2px 0 #25f4ee; }
.brand-name { font-weight: 600; letter-spacing: .5px; color: #fff; font-size: 15px; }

.nav { flex: 1; padding: 6px 12px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-bottom: 4px;
    border-radius: 8px; color: #9ca3af; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 500; }
.nav-ico { width: 18px; text-align: center; font-size: 13px; color: var(--brand); }
.nav-item.active .nav-ico { color: var(--brand); }

.sidebar-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { font-size: 13px; color: #e5e7eb; margin-bottom: 4px; }
.sidebar-logout { font-size: 12px; color: #6b7280; }
.sidebar-logout:hover { color: var(--brand); }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 0 24px 40px; min-width: 0; }

.topbar {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 0 16px;
    position: sticky; top: 0; background: var(--bg); z-index: 30;
}
.topbar-title { font-size: 20px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.menu-btn { display: none; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid rgba(16,24,40,.045);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; font-weight: 650; letter-spacing: .01em; }
.card-sub { font-size: 12px; color: var(--text-3); line-height: 1.6; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.stat-card .stat-num { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.25; }
.stat-num.ok { color: var(--ok); }
.stat-num.bad { color: var(--bad); }
.warn-text { color: var(--warn); }

/* 页签 */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab {
    padding: 9px 18px; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--text-2); font-size: 13px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.tab.cur { background: var(--text); border-color: var(--text); color: #fff; font-weight: 500; }
.tab-cnt {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 .card { margin-bottom: 20px; }

.mini-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow: auto; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: #fafafa; cursor: pointer; transition: background .15s; }
.mini-item:hover { background: var(--gray-bg); }
.mini-item img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--gray-bg); flex-shrink: 0; }
.mini-title { flex: 1; min-width: 0; }
.mini-title b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title span { font-size: 12px; color: var(--text-3); }
.mini-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-num.bad { color: var(--bad); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    text-align: left; font-weight: 500; color: var(--text-3);
    padding: 10px 12px; border-bottom: 1px solid var(--line);
    white-space: nowrap; font-size: 12px; letter-spacing: .05em;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f8f9fb; }

.v-cell { display: flex; gap: 10px; align-items: center; min-width: 220px; max-width: 340px; }
.v-cell img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--gray-bg); flex-shrink: 0; }
.v-meta { min-width: 0; }
.v-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.v-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.v-row.offline .v-title { color: var(--bad); }

/* 状态徽章 */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok   { color: var(--ok); background: var(--ok-bg); }
.badge.bad  { color: var(--bad); background: var(--bad-bg); }
.badge.wait { color: var(--warn); background: var(--warn-bg); }
.badge.gray { color: var(--text-2); background: var(--gray-bg); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--line); border-radius: 9px;
    background: #fff; color: var(--text); font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all .16s ease; white-space: nowrap; font-family: inherit;
}
.btn:hover { border-color: #d3d7dd; background: #fafbfc; }
.btn:active { transform: translateY(1px); }
.btn.primary {
    background: linear-gradient(135deg, #fe2c55, #ff5472);
    border-color: transparent; color: #fff;
    box-shadow: 0 4px 12px rgba(254,44,85,.28);
}
.btn.primary:hover { background: linear-gradient(135deg, #ef2650, #ff4567); box-shadow: 0 6px 16px rgba(254,44,85,.34); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.input {
    width: 100%; padding: 9px 12px; border: 1px solid #e3e6eb;
    border-radius: 9px; font-size: 13px; background: #fff; color: var(--text);
    transition: border-color .15s, box-shadow .15s; font-family: inherit; letter-spacing: .01em;
}
.input:hover { border-color: #d3d7dd; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(254,44,85,.1); }
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; }
select.input { cursor: pointer; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; }
.toolbar #fKeyword { width: 220px; }

.form label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.form .input { margin-top: 6px; }
.form-label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin: 14px 0 6px; letter-spacing: .02em; }
.form-label:first-child { margin-top: 0; }
.form-label .sub { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-top: 2px; }

/* ---------- 登录页 ---------- */
.center-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
    width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,.08); padding: 36px 32px;
}
.auth-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.auth-tip { margin-top: 16px; font-size: 12px; color: var(--text-3); text-align: center; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- 弹窗 / 抽屉 ---------- */
.mask {
    position: fixed; inset: 0; background: rgba(15,18,24,.5); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal {
    background: #fff; border-radius: 18px; width: 100%; max-width: 560px;
    max-height: 88vh; display: flex; flex-direction: column;
    box-shadow: 0 24px 64px rgba(16,24,40,.22), 0 2px 8px rgba(16,24,40,.08);
    animation: pop .22s cubic-bezier(.34,1.4,.64,1);
}
.modal.sm { max-width: 420px; }
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h3 { font-size: 16.5px; font-weight: 650; letter-spacing: .01em; }
.modal-body { padding: 14px 24px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 2px 24px 22px; }
.modal-foot .btn { min-width: 88px; }
.x { background: none; border: none; font-size: 15px; color: var(--text-3); cursor: pointer; padding: 4px 9px; border-radius: 8px; transition: all .15s; }
.x:hover { color: var(--text); background: var(--gray-bg); }

.add-result { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; max-height: 180px; overflow: auto; }
.add-line { font-size: 12px; padding: 4px 0; color: var(--text-2); }
.add-line b.ok { color: var(--ok); font-weight: 500; }
.add-line b.bad { color: var(--bad); font-weight: 500; }

.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 90; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 96vw;
    background: #fff; z-index: 95; box-shadow: -8px 0 30px rgba(0,0,0,.12);
    display: flex; flex-direction: column; animation: slidein .2s ease;
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

.d-cover { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; background: var(--gray-bg); margin-bottom: 14px; }
.d-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.d-note { font-size: 12px; color: var(--text-3); margin-bottom: 14px; word-break: break-all; }
.d-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.d-stat { background: #fafafa; border-radius: 8px; padding: 10px 6px; text-align: center; }
.d-stat b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.d-stat span { font-size: 11px; color: var(--text-3); }
.d-sec { font-size: 13px; font-weight: 600; margin: 18px 0 10px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.kv .v { word-break: break-all; }
.chart-box { height: 220px; margin-bottom: 8px; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.inline-select { display: flex; gap: 8px; align-items: center; }
.inline-select select { width: auto; flex: 1; }

/* 时间线 */
.timeline { border-left: 2px solid var(--line); margin-left: 5px; padding-left: 16px; display: flex; flex-direction: column; gap: 12px; }
.tl-item { position: relative; font-size: 12px; }
.tl-item::before { content: ""; position: absolute; left: -21.5px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.tl-item.ok::before { background: var(--ok); }
.tl-item.bad::before { background: var(--bad); }
.tl-item b { display: block; font-size: 13px; font-weight: 500; }
.tl-item span { color: var(--text-3); }

/* ---------- 其他 ---------- */
.pager { display: flex; gap: 6px; justify-content: flex-end; padding-top: 14px; flex-wrap: wrap; }
.pager button {
    min-width: 32px; padding: 5px 10px; border: 1px solid var(--line); background: #fff;
    border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--text-2);
}
.pager button.cur { background: var(--text); color: #fff; border-color: var(--text); }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .p-info { font-size: 12px; color: var(--text-3); align-self: center; margin-right: auto; }

.key-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.key-code {
    flex: 1; background: #f5f6f8; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px;
    font-size: 13px; word-break: break-all; font-family: "SF Mono", Consolas, Menlo, monospace; color: var(--text);
}
.guide { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--text-2); }
.guide code { background: var(--gray-bg); padding: 2px 8px; border-radius: 5px; font-size: 12px; word-break: break-all; }
.guide b { color: var(--text); }

.toast {
    position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
    background: #17181a; color: #fff; padding: 11px 24px; border-radius: 999px;
    font-size: 13px; z-index: 200; box-shadow: 0 10px 30px rgba(16,24,40,.28);
    animation: toastin .2s ease; max-width: 86vw; text-align: center; font-weight: 500;
}
.toast.err { background: var(--bad); }
@keyframes toastin { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%; height: auto; bottom: auto;
        flex-direction: row; align-items: center;
        padding: 0 10px;
    }
    .brand { padding: 12px 8px; }
    .brand-name { display: none; }
    .nav { display: flex; padding: 0; flex: 1; overflow-x: auto; }
    .nav-item { padding: 14px 10px; border-radius: 0; margin: 0; font-size: 13px; }
    .nav-item.active { background: none; border-bottom: 2px solid var(--brand); }
    .sidebar-foot { display: none; }
    .main { margin-left: 0; padding: 0 14px 30px; padding-top: 50px; }
    .topbar { padding: 12px 0; }
    .topbar-title { font-size: 17px; }
    .menu-btn { display: none; }
    .live-text { display: none; }
    .v-cell { min-width: 160px; }
    .v-title, .v-sub { max-width: 150px; }
    .d-stats { grid-template-columns: repeat(3, 1fr); }
    .toolbar #fKeyword { width: 100%; }
}

/* 素材上传进度条 */
.mat-prog { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 480px; margin-top: 10px; }
.mat-prog .track { flex: 1; height: 8px; background: #eef0f2; border-radius: 99px; overflow: hidden; }
.mat-prog .fill { height: 100%; width: 0; background: #fe2c55; border-radius: 99px; transition: width .15s ease; }
.mat-prog .pct { font-size: 12px; color: #888; min-width: 46px; text-align: right; }
.mat-prog.done .fill { background: #07c160; }

/* 素材列表：一条记录 = 主体(视频/图文/文字)+配乐+标题/文案/话题 */
/* 列宽：缩略图 96px | 标题+文案 弹性 | 话题 13% | 配乐 16% | 信息 13% | 按钮自适应 */
.mat-list { display: flex; flex-direction: column; gap: 10px; }
.mat-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 13% 16% 13% auto; gap: 14px; align-items: center; padding: 10px 14px; border: 1px solid #eef0f2; border-radius: 10px; background: #fff; }
.mat-row .mat-thumb { width: 96px; height: 60px; border-radius: 8px; background: #000; object-fit: cover; }
/* 图文素材：浅底缩略图 + 右下角"N图"角标，点击打开查看弹窗 */
.mat-row img.mat-thumb { background: #f2f3f5; }
.mat-row .mat-thumb.mat-multi { position: relative; cursor: pointer; }
.mat-row .mat-thumb.mat-multi img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; display: block; }
.mat-row .mat-thumb .mat-cnt { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 99px; }
/* 文字素材：靛蓝渐变块 + "文"字 */
.mat-row .mat-thumb.mat-text { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #36d1dc, #5b86e5); }
.mat-row .mat-thumb.mat-text .ico { color: #fff; font-size: 22px; font-weight: 700; line-height: 1; }
.mat-row .mat-main { min-width: 0; }
.mat-row .mat-title { min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-row .mat-content { min-width: 0; font-size: 12.5px; color: #555; line-height: 1.5; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mat-row .mat-tags { min-width: 0; font-size: 12.5px; color: #4a72d4; line-height: 1.5; word-break: break-all; }
.mat-row .mat-music { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mat-row .mat-music .dim, .mat-row .mat-tags .dim { color: #c0c4cc; }
.mat-music-name { min-width: 0; font-size: 12.5px; color: #7c4dbd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-row .v-sub { min-width: 0; margin-bottom: 0; font-size: 12px; color: #8a8f99; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-row .mat-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
/* 查看图文弹窗：图片网格 + 逐张下载 */
.mv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 10px; }
.mv-item { text-align: center; }
.mv-item img { width: 100%; border-radius: 8px; background: #f2f3f5; border: 1px solid #eef0f2; }
.mv-item .btn { margin-top: 6px; }
/* 窄屏：换行堆叠，主体/文案/话题/配乐/信息/按钮各占一行 */
@media (max-width: 900px) {
    .mat-row { display: flex; flex-wrap: wrap; row-gap: 6px; align-items: flex-start; }
    .mat-row .mat-thumb { flex: none; }
    .mat-row .mat-main { flex: 1 1 auto; }
    .mat-row .mat-title { white-space: normal; }
    .mat-row .mat-content, .mat-row .mat-tags, .mat-row .mat-music { flex: 1 1 100%; }
    .mat-row .mat-music-name { flex: 1; }
    .mat-row .v-sub { flex: 1 1 100%; white-space: normal; }
    .mat-row .mat-acts { flex: 1 1 100%; justify-content: flex-start; }
}
.empty { padding: 30px 0; text-align: center; color: #999; font-size: 13px; }

/* 系统设置-佣金金额：响应式多列输入 */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.reward-grid label { font-size: 13px; color: #444; display: flex; flex-direction: column; gap: 5px; }
.reward-grid input { width: 100%; }

/* ---------- 全局细节 ---------- */
::selection { background: rgba(254,44,85,.16); }

/* 细滚动条（webkit 内核） */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d7dd; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b9bec6; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 弹窗内 textarea 高度自适应提示 */
.modal-body textarea.input { min-height: 96px; }

