:root {
    --primary: #0e7490;
    --primary-dark: #155e75;
    --primary-light: #ecfeff;
    --ok: #16a34a;
    --err: #dc2626;
    --warn: #d97706;
    --text: #1f2937;
    --muted: #6b7280;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== 顶栏 ===== */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff; padding: 14px 24px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar .brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.topbar .brand .bar-logo { width: 28px; height: 28px; object-fit: cover; border-radius: 7px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.topbar .brand small { font-weight: 400; opacity: .8; font-size: 12px; margin-left: 8px; }
.topbar .userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .userbox a { color: #cffafe; cursor: pointer; text-decoration: none; font-size: 13px; }
.topbar .userbox a:hover { color: #fff; text-decoration: underline; }

/* ===== 容器 ===== */
.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px; margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card h2 { font-size: 16px; margin-bottom: 14px; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.card h2 .tag { font-size: 11px; font-weight: 400; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 10px; }

/* ===== 按钮 ===== */
.btn {
    display: inline-block; border: none; cursor: pointer; border-radius: 6px;
    padding: 9px 20px; font-size: 14px; font-family: inherit;
    background: var(--primary); color: #fff; transition: all .15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { background: #94a3b8; cursor: not-allowed; }
.btn.big { font-size: 16px; padding: 12px 36px; font-weight: 700; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost:hover { background: var(--primary-light); }
.btn.danger { background: var(--err); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 4px 12px; font-size: 12px; }
.btn.link { background: none; color: var(--primary); padding: 2px 6px; }
.btn.link:hover { text-decoration: underline; background: none; }

/* ===== 表单 ===== */
input[type=text], input[type=password] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px; font-family: inherit; outline: none;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,116,144,.12); }
label.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
label.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-right: 18px; cursor: pointer; }

/* ===== 消息条 ===== */
.msg { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.msg.ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.msg.warn { background: #fffbeb; color: var(--warn); border: 1px solid #fde68a; }

/* ===== 开始按钮旁的超市名称行 ===== */
.store-run-row {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; flex-wrap: wrap;
}
.store-run-row input[type=text] {
    flex: 1; width: auto; min-width: 220px; max-width: 480px;
    font-weight: 600;
}
.store-run-row .btn { margin-left: auto; }

/* ===== 登录页 ===== */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
    background: #fff; border-radius: 14px; padding: 40px 36px; width: 380px;
    box-shadow: 0 8px 30px rgba(0,0,0,.1);
}
.login-card .logo { text-align: center; margin-bottom: 26px; }
.login-card .logo .icon { font-size: 42px; }
.login-card .logo .logo-img {
    width: 150px; height: 150px; object-fit: cover; border-radius: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,.15); display: block; margin: 0 auto 12px;
}
.login-card .logo h1 { font-size: 20px; color: var(--primary-dark); margin-top: 8px; }
.login-card .logo p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-card .form-item { margin-bottom: 16px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-tip { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; line-height: 1.7; }

/* 身份选择门户（v2.5） */
.role-card {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; margin-top: 14px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    cursor: pointer; text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.role-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(14,116,144,.12); transform: translateY(-1px); }
.role-icon { font-size: 30px; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; background: var(--primary-light); border-radius: 12px; flex-shrink: 0; }
.role-body { flex: 1; min-width: 0; }
.role-name { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.role-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.role-arrow { font-size: 22px; color: var(--muted); flex-shrink: 0; }
.back-link { font-size: 13px; color: var(--primary); cursor: pointer; margin-bottom: 6px; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* ===== 文件夹槽 ===== */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.slot {
    border: 1.5px dashed var(--border); border-radius: 10px; padding: 14px;
    background: #fafcfe; transition: border-color .15s;
}
.slot.drag { border-color: var(--primary); background: var(--primary-light); }
.slot .slot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.slot .slot-title { font-size: 14px; font-weight: 700; }
.slot .slot-title.required { color: var(--primary-dark); }
.slot .slot-hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.slot .upbtn { font-size: 12px; }
.filelist { list-style: none; }
.filelist li {
    display: flex; align-items: center; gap: 8px; font-size: 13px;
    padding: 6px 8px; border-radius: 6px; margin-bottom: 4px; background: #fff;
    border: 1px solid var(--border);
}
.filelist li .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filelist li .fmeta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.filelist li .fdel { color: var(--err); cursor: pointer; font-size: 15px; line-height: 1; }
.empty-tip { font-size: 12px; color: #94a3b8; text-align: center; padding: 8px 0; }

/* ===== 进度 ===== */
.progress-card .state-line { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.state-badge {
    padding: 3px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
}
.state-badge.run { background: #dbeafe; color: #1d4ed8; }
.state-badge.done { background: #dcfce7; color: var(--ok); }
.state-badge.err { background: #fee2e2; color: var(--err); }
.state-badge.idle { background: #e2e8f0; color: var(--muted); }
.progressbar { height: 16px; background: #e2e8f0; border-radius: 8px; overflow: hidden; margin: 8px 0; }
.progressbar .fill { height: 100%; background: linear-gradient(90deg, var(--primary), #22d3ee); border-radius: 8px; transition: width .5s; width: 0; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.progress-detail { font-size: 13px; margin-top: 10px; background: var(--bg); padding: 8px 12px; border-radius: 6px; min-height: 20px; }

/* ===== 任务分支（手风琴） ===== */
.section-label { font-size: 14px; font-weight: 700; color: var(--text); margin: 4px 0 12px; }
.branch {
    background: var(--card); border: 1.5px solid var(--border); border-radius: 10px;
    margin-bottom: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05); overflow: hidden;
    transition: border-color .2s;
}
.branch.open { border-color: var(--primary); }
.branch-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; cursor: pointer; user-select: none; transition: background .15s;
}
.branch-head:hover { background: #f8fafc; }
.branch-info { flex: 1; min-width: 0; }
.branch-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.branch-badge { font-size: 12px; font-weight: 400; color: #fff; padding: 3px 10px; border-radius: 10px; white-space: nowrap; }
.branch-badge.b1 { background: var(--primary); }
.branch-badge.b2 { background: var(--warn); }
.branch-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.branch-state { font-size: 12px; font-weight: 400; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.branch-state.ok { background: #dcfce7; color: var(--ok); }
.branch-state.warn { background: #fef3c7; color: #b45309; }
.branch-arrow { font-size: 15px; color: var(--muted); transition: transform .2s; flex-shrink: 0; margin-left: 14px; }
.branch.open .branch-arrow { transform: rotate(90deg); }
.branch-body { display: none; padding: 16px 20px 20px; border-top: 1px dashed var(--border); }
.branch.open .branch-body { display: block; }
.btn.amber { background: var(--warn); }
.btn.amber:hover { background: #b45309; }

/* ===== 表格 ===== */
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
table.list th { color: var(--muted); font-weight: 600; background: #f8fafc; font-size: 12px; }
table.list tr:hover td { background: #f8fafc; }
.table-scroll { overflow-x: auto; }

/* ===== 任务列表 ===== */
.job-item { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.job-item .job-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.job-item .job-id { font-weight: 700; font-size: 14px; }
.job-item .job-meta { font-size: 12px; color: var(--muted); }
.job-item .job-files { display: flex; flex-wrap: wrap; gap: 8px; }
.job-item .job-files a {
    font-size: 12px; color: var(--primary); background: var(--primary-light);
    padding: 3px 10px; border-radius: 5px; text-decoration: none;
}
.job-item .job-files a:hover { background: #cffafe; }

/* ===== 结果文件 ===== */
.result-files { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.result-files a {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    text-decoration: none; color: var(--text); font-size: 14px; background: #fff;
}
.result-files a:hover { border-color: var(--primary); background: var(--primary-light); }
.result-files a .dl { color: var(--primary); font-size: 13px; font-weight: 700; }

.muted { color: var(--muted); font-size: 12px; }
.mt10 { margin-top: 10px; } .mt16 { margin-top: 16px; } .mb10 { margin-bottom: 10px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hide { display: none !important; }

@media (max-width: 640px) {
    .topbar { padding: 10px 14px; }
    .topbar .brand { font-size: 15px; }
    .card { padding: 14px; }
    .login-card { padding: 28px 20px; width: 100%; }
}