:root {
  color-scheme: light;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #253449;
  background: #f5f7fb;
  --accent: #3569da;
  --muted: #5d6d85;
  --line: #e1e7f0;
  --paper: #fff;
  --error: #96243a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 750; letter-spacing: .03em; }
.brand span { color: #78869a; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection { color: var(--muted); font-size: .85rem; text-align: right; }
#logout { min-height: 36px; padding: 5px 10px; background: var(--paper); border-color: #d2dceb; color: var(--accent); font-size: .85rem; white-space: nowrap; }
#logout:hover { background: #edf3ff; }
.login {
  max-width: 460px;
  margin: clamp(28px, 7vw, 62px) auto;
  padding: clamp(20px, 4vw, 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.login > p { color: var(--muted); font-size: .95rem; line-height: 1.65; }
#login-submit, #password-login-submit, #save-password { margin-top: 12px; }
#private-login { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
#private-login form { margin-top: 0; }
#private-login summary { color: var(--accent); font-size: .9rem; cursor: pointer; }
.workspace { display: grid; grid-template-columns: minmax(230px, 310px) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); padding-block: 54px 72px; }
h1, h2 { margin: 0; line-height: 1.3; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.12rem; }
p { margin: .65rem 0; }
.new-task > p, .code-upload > p { font-size: .93rem; line-height: 1.6; color: var(--muted); }
form { margin-top: 26px; }
.node-key-settings, .password-settings, .backend-settings { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.password-settings form, .backend-settings form, .code-upload form { margin-top: 0; }
.code-upload { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.code-input-row { display: flex; align-items: center; gap: 8px; }
.code-input-row input { flex: 1; min-width: 0; }
.code-input-row button { flex: none; }
.new-task summary { color: var(--muted); font-weight: 650; cursor: pointer; }
#save-backend { display: block; margin-top: 12px; }
label { display: block; margin: 16px 0 7px; font-weight: 650; font-size: .88rem; }
textarea, select, input, button { font: inherit; }
textarea, select, input[type="file"], input[type="url"], input[type="password"], input[type="text"] { display: block; width: 100%; padding: 9px 11px; background: var(--paper); color: inherit; border: 1px solid #c0ccde; border-radius: 6px; }
textarea { resize: vertical; min-height: 95px; }
button { min-height: 44px; padding: 9px 15px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 650; cursor: pointer; transition: background .15s, border-color .15s; }
button:not(:disabled):hover { background: #2859c8; }
button:disabled { opacity: .57; cursor: default; }
:focus-visible { outline: 3px solid #8aafff; outline-offset: 3px; }
#submit, #upload-code-result { display: block; margin-top: 20px; min-width: 132px; }
.message { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.message:empty { display: none; }
.message.error { color: var(--error); }
.queue-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#queue-count { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.empty { min-height: 128px; display: grid; place-items: center; padding: 22px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: center; }
.job { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.job-info { min-width: 0; }
.job-heading { display: flex; gap: 7px 12px; flex-wrap: wrap; align-items: center; }
.job-channel { font-weight: 750; }
.job-stage { font-size: .83rem; color: var(--accent); background: #edf3ff; border-radius: 4px; padding: 3px 7px; }
.job-stage[data-stage="failed"], .job-stage[data-stage="expired"] { color: var(--error); background: #f8e9ec; }
.job-stage[data-stage="cancelled"] { color: var(--muted); background: #eef1f7; }
.job-id { display: block; margin-top: 7px; overflow-wrap: anywhere; color: var(--muted); font-size: .78rem; }
.job-detail, .job-expires { color: var(--muted); font-size: .87rem; overflow-wrap: anywhere; }
.job-detail:empty, .job-expires:empty { display: none; }
.job-receipt { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-block: 10px; font-size: .85rem; }
.job-receipt ul { display: flex; flex-wrap: wrap; gap: 5px; padding: 0; margin: 0; list-style: none; }
.job-receipt li { background: #eef1f7; padding: 3px 6px; border-radius: 3px; }
.cancel { margin-top: 5px; min-height: 40px; background: transparent; border-color: #c0ccde; color: var(--accent); }
.cancel:not(:disabled):hover { background: #edf3ff; border-color: var(--accent); }
.job-qr { width: 176px; min-height: 176px; padding: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; }
.job-qr img { display: block; width: 160px; height: 160px; object-fit: contain; }
.job-qr img:not([src]) { display: none; }
.qr-message { padding: 6px; font-size: .8rem; color: var(--muted); text-align: center; }
.qr-message:empty { display: none; }
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); padding-block: 30px 42px; gap: 38px; }
}
@media (max-width: 400px) {
  .job { grid-template-columns: 1fr; }
  #submit, #save-backend, #upload-code-result { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
