:root {
  --sider: #304156;
  --sider-2: #263445;
  --bg: #f0f2f5;
  --card: #fff;
  --text: #303133;
  --muted: #909399;
  --line: #ebeef5;
  --primary: #409eff;
  --primary-hover: #66b1ff;
  --danger: #f56c6c;
  --success: #67c23a;
  --warning: #e6a23c;
  --nav: 50px;
  --sider-w: 200px;
  --shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.5 "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.layout { display: flex; min-height: 100%; }
.sider {
  width: var(--sider-w); flex-shrink: 0; background: var(--sider); color: #bbb;
  min-height: 100vh; position: sticky; top: 0; align-self: flex-start;
}
.logo {
  display: block; height: var(--nav); line-height: var(--nav); text-align: center;
  font-weight: 700; font-size: 16px; color: #fff; background: var(--sider-2); letter-spacing: 1px;
}
.logo:hover { color: #fff; }
.nav-label { margin: 18px 20px 6px; font-size: 12px; color: #738299; }
.sider nav a {
  display: block; padding: 11px 20px 11px 24px; color: #bfcbd9; border-left: 3px solid transparent;
}
.sider nav a:hover { color: #fff; background: #263445; }
.sider nav a.on { color: #fff; background: #263445; border-left-color: var(--primary); }

.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.navbar {
  height: var(--nav); background: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 21, 41, 0.04);
}
.crumb { font-size: 16px; font-weight: 600; }
.who { color: var(--muted); }
.who span { margin-right: 16px; }
.who a { color: var(--muted); }
.who a:hover { color: var(--primary); }

.content { padding: 20px 24px 40px; }
.page-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.sched-bar {
  margin: -8px 0 16px; padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
}
.sched-bar.is-on { background: #f0f9eb; color: #67c23a; border: 1px solid #e1f3d8; }
.sched-bar.is-off { background: #fdf6ec; color: #e6a23c; border: 1px solid #faecd8; }
.sched-bar a { margin-left: 8px; }
.sched-hero {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding: 18px 20px; border-radius: var(--radius); margin-bottom: 16px;
}
.sched-hero.is-on { background: #f0f9eb; border: 1px solid #e1f3d8; }
.sched-hero.is-off { background: #fdf6ec; border: 1px solid #faecd8; }
.sched-state { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.sched-hero.is-on .sched-state { color: #67c23a; }
.sched-hero.is-off .sched-state { color: #e6a23c; }
.sched-next { font-size: 15px; margin: 8px 0 0; }
.auto-tag {
  font-size: 11px; font-weight: 500; color: #e6a23c; background: #fdf6ec;
  border-radius: 10px; padding: 1px 8px; margin-left: 4px; vertical-align: middle;
}
.auto-tag.on { color: #67c23a; background: #f0f9eb; }
.pack-stat { margin: 4px 0 0; font-size: 12px; color: #606266; }
.pack-stat b { color: var(--text); }
.warn-inline { color: #e6a23c; }
.page-bar .hint, .hint { color: var(--muted); font-size: 13px; }
.panel { background: #fff; padding: 8px 16px 16px; border-radius: var(--radius); box-shadow: var(--shadow); }

h1 { font-size: 18px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 16px; margin: 0 0 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; margin: 4px 0 0; }

label { display: block; margin: 12px 0; color: #606266; }
input, select, button, textarea { font: inherit; }
input[type=text], input[type=password], input:not([type]), select, input[type=file],
input[type=number], input[type=date], input[type=time], input[type=datetime-local] {
  width: 100%; padding: 9px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.chk { display: flex; align-items: center; gap: 8px; }
.chk input { width: auto; }
.chk.tight { margin: 0; }

button, .btn {
  display: inline-block; padding: 8px 18px; background: var(--primary); color: #fff;
  border: 0; border-radius: 4px; text-decoration: none; cursor: pointer; line-height: 1.4;
}
button:hover, .btn:hover { background: var(--primary-hover); color: #fff; }
.btn.ghost, button.ghost, .ghost-btn {
  background: #fff; color: #606266; border: 1px solid #dcdfe6; padding: 6px 12px;
}
.btn.ghost:hover, .ghost-btn:hover { border-color: var(--primary); color: var(--primary); background: #ecf5ff; }
button.danger, .btn.danger { background: var(--danger); color: #fff; border: 0; }
button.danger:hover { background: #f78989; }

.flash, .warn { padding: 10px 14px; margin-bottom: 12px; border-radius: 4px; background: #ecf5ff; color: #409eff; border: 1px solid #d9ecff; }
.warn { background: #fef0f0; color: #f56c6c; border-color: #fde2e2; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fafafa; color: #909399; font-weight: 600; font-size: 13px; }
tr:hover td { background: #f5f7fa; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
.acts a, .acts button { margin: 2px 4px 2px 0; }
.inline { display: inline; }

.form, .form.compact { background: #fff; padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form.compact { margin-bottom: 16px; max-width: 520px; }
.app-form { max-width: 720px; }
fieldset { border: 1px solid var(--line); margin: 0 0 16px; padding: 16px; border-radius: 4px; }
legend { padding: 0 8px; color: #606266; font-weight: 600; }
pre.log { background: #1d1e1f; color: #ddd; padding: 12px; overflow: auto; max-height: 240px; font-size: 12px; margin: 8px 0 0; border-radius: 4px; }
.form-inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.form-inline input { width: auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.icon-preview { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; display: block; margin: 8px auto 4px; pointer-events: none; }
.card { background: #fff; padding: 24px; border-radius: var(--radius); max-width: 480px; box-shadow: var(--shadow); }

.kind-pills { display: flex; gap: 8px; margin-bottom: 8px; }
.pill {
  margin: 0; padding: 6px 16px; border: 1px solid #dcdfe6; border-radius: 16px;
  cursor: pointer; background: #fff; color: #606266;
}
.pill input { display: none; }
.pill:has(input:checked) { border-color: var(--primary); color: var(--primary); background: #ecf5ff; }

.upload-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin: 8px 0 16px; }
.file-box-main { min-height: 120px; }
.meta-card {
  display: flex; gap: 14px; align-items: center; background: #f5f7fa;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px;
}
.facts-icon { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: #ecf5ff; flex-shrink: 0; }
.facts-letter {
  width: 56px; height: 56px; border-radius: 12px; background: #ecf5ff; color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex-shrink: 0;
}
.facts-letter[hidden], .facts-icon[hidden], .icon-preview[hidden] { display: none !important; }
.facts-name { font-weight: 600; font-size: 15px; }
.facts-line { margin: 2px 0 0; word-break: break-all; }
.facts-body { min-width: 0; }
.file-box {
  position: relative; margin: 0; padding: 16px; border: 1px dashed #dcdfe6; border-radius: var(--radius);
  text-align: center; background: #fafafa; cursor: pointer; overflow: hidden;
}
.file-box:hover { border-color: var(--primary); background: #ecf5ff; }
.file-box input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 4px; pointer-events: none; }
.file-tip { display: block; color: var(--muted); font-size: 12px; word-break: break-all; pointer-events: none; }

.adv { margin: 8px 0 16px; background: #fafafa; border-radius: var(--radius); padding: 4px 16px 8px; }
.adv summary { cursor: pointer; padding: 10px 0; color: #606266; font-weight: 600; }
.adv-body { padding-bottom: 8px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.done-box { background: #f0f9eb; border: 1px solid #e1f3d8; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.done-box p { margin: 6px 0; }

.empty-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  text-align: center; padding: 64px 24px; color: var(--muted);
}
.empty-card h2 { color: var(--text); margin-bottom: 8px; }
.empty-card .btn { margin-top: 16px; }

.app-list { display: flex; flex-direction: column; gap: 12px; }
.app-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 12px;
}
.app-head { display: flex; align-items: center; gap: 14px; }
.app-icon {
  width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: #ecf5ff;
}
.app-icon.letter {
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 700; font-size: 18px;
}
.app-meta { flex: 1; min-width: 0; }
.app-meta h3 { margin: 0; font-size: 16px; font-weight: 600; }
.app-url { margin: 2px 0 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-tag {
  font-size: 11px; font-weight: 500; color: var(--primary); background: #ecf5ff;
  border-radius: 10px; padding: 1px 8px; margin-left: 6px; vertical-align: middle;
}
.badge {
  border: 0; background: #f4f4f5; color: #909399; border-radius: 12px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; flex-shrink: 0;
}
.badge.st-FINISH { background: #f0f9eb; color: var(--success); }
.badge.st-FAIL { background: #fef0f0; color: var(--danger); }
.badge.st-PACKING, .badge.st-UNPACKING, .badge.st-QUEUED { background: #fdf6ec; color: var(--warning); }
.badge.st-CANCEL { background: #f4f4f5; color: var(--muted); }
.bar { height: 4px; background: var(--line); margin: 12px 0 10px; border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .3s; }
.app-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.app-foot .when-idle, .app-foot .when-busy, .app-foot .dl-box { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-foot [hidden], .dl-box[hidden] { display: none !important; }
.app-card .row-log { margin-top: 10px; }

.switch-form { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer; color: var(--muted); font-size: 13px; }
.switch input { display: none; }
.switch span {
  width: 34px; height: 18px; background: #dcdfe6; border-radius: 9px; position: relative; display: inline-block;
}
.switch span::after {
  content: ""; width: 14px; height: 14px; background: #fff; border-radius: 50%;
  position: absolute; top: 2px; left: 2px; transition: left .15s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { left: 18px; }

.more { position: relative; display: inline-block; }
.more summary { list-style: none; cursor: pointer; color: var(--muted); padding: 6px 10px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; }
.more summary::-webkit-details-marker { display: none; }
.more-menu {
  position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: var(--shadow); padding: 8px; z-index: 5; min-width: 140px;
}
.more-menu form { margin: 4px 0; }
.more-menu button { width: 100%; }

body.is-login { background: #2d3a4b; min-height: 100vh; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 400px; max-width: 100%; background: #fff; padding: 40px 32px 32px; border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.login-card h1 { text-align: center; margin-bottom: 8px; }
.login-card .muted { text-align: center; margin: 0 0 24px; }
.login-card button { width: 100%; margin-top: 12px; padding: 10px; font-size: 15px; }
.login-flash { max-width: 400px; margin: 24px auto 0; }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sider { width: 100%; min-height: 0; position: static; }
  .sider nav { display: flex; flex-wrap: wrap; }
  .sider nav a { padding: 8px 14px; }
  .nav-label { display: none; }
  .grid-2, .grid-3, .upload-row { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .content { padding: 16px; }
}
