:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --border: #e6e8eb;
    --text: #1f2329;
    --muted: #8a919c;
    --primary: #3b6cf0;
    --primary-dark: #2f5ad4;
    --danger: #e5484d;
    --ok: #18a058;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 24px 16px 60px; }

/* 顶部导航 */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.brand { font-size: 18px; font-weight: 700; }
.brand .dot { color: var(--primary); }
.topbar .links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    margin-left: 16px;
}
.topbar .links a:hover { color: var(--primary); }

/* 卡片 */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 { font-size: 16px; margin: 0 0 16px; }

/* 表单 */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=url], textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fbfbfd;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 108, 240, 0.12);
    background: #fff;
}
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: #f5f6f8; }
.btn.danger { background: var(--danger); }

.row { display: flex; gap: 10px; }
.row input { flex: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
.alert {
    font-size: 13px;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 16px;
}
.alert.err { background: #fdecec; color: #b4232a; border: 1px solid #f5c6c8; }
.alert.ok { background: #e9f9ef; color: #0b7a3b; border: 1px solid #b7e7c8; }
.alert.warn { background: #fff8e6; color: #8a6d1a; border: 1px solid #f0e2b3; }

/* 状态徽章 */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge.pending { background: #eef0f3; color: #5a6270; }
.badge.downloading { background: #e8f0ff; color: #2f5ad4; }
.badge.done { background: #e9f9ef; color: #0b7a3b; }
.badge.error { background: #fdecec; color: #b4232a; }

/* 任务列表 */
.task { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.task .t-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.task .t-url {
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.task .t-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.task .t-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

.progress { height: 8px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b6cf0, #6a8df5);
    border-radius: 6px;
    transition: width .3s ease;
}
.progress.indeterminate > span {
    width: 40% !important;
    animation: slide 1.2s ease-in-out infinite;
}
@keyframes slide {
    0% { margin-left: -40%; }
    100% { margin-left: 100%; }
}

.empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* 登录页 */
.login-box { max-width: 380px; margin: 80px auto; }
.login-box .brand { text-align: center; font-size: 22px; margin-bottom: 24px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }

@media (max-width: 600px) {
    .row { flex-direction: column; }
    .status-head { flex-direction: column; align-items: flex-start; }
    .status-actions { width: 100%; }
    .status-row { flex-direction: column; align-items: flex-start; }
    .status-label { min-width: 0; }
    .status-time { margin-left: 0; }
}

/* 账号与会话状态卡片 */
.status-card { padding: 18px 20px 16px; }
.status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.status-head h2 { margin: 0; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-actions .btn { padding: 6px 12px; font-size: 13px; }

.status-loading { color: var(--muted); font-size: 13px; padding: 14px 0; text-align: center; }

.status-rows { display: flex; flex-direction: column; gap: 8px; }
.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfbfd;
    font-size: 13px;
    flex-wrap: wrap;
}
.status-row .status-text { flex: 1; min-width: 0; }

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    font-size: 0;
    flex-shrink: 0;
}
.status-dot.ok   { background: var(--ok); }
.status-dot.warn { background: #f5a623; }
.status-dot.err  { background: var(--danger); }
.status-dot.gray { background: #c8ccd2; }

.status-label { font-weight: 600; min-width: 100px; flex-shrink: 0; color: var(--text); }
.status-text code {
    background: #eef0f3;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text);
}
.status-text .muted { color: var(--muted); }
.status-time { color: var(--muted); font-size: 12px; flex-shrink: 0; margin-left: auto; }

.status-ok-text   { color: var(--ok); font-weight: 600; }
.status-warn-text { color: #c47d10; font-weight: 600; }
.status-err-text  { color: var(--danger); font-weight: 600; }
