:root{
  color-scheme:light;
  --ink:#18181b;
  --muted:#71717a;
  --surface:#ffffff;
  --background:#f8f8f7;
  --line:#e4e4e7;
  --line-strong:#d4d4d8;
  --soft:#f4f4f5;
  --success:#16803c;
  --warn:#a16207;
  --danger:#c0262d;
  font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;
}
*{box-sizing:border-box}
body{margin:0;min-height:100vh;background:var(--background);color:var(--ink)}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
button:disabled{cursor:not-allowed;opacity:.55}
.mark,.eyebrow{display:none}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:24px}
.login-card{width:min(380px,100%);padding:36px;background:var(--surface);border:1px solid var(--line);border-radius:12px;text-align:left}
.login-card h1{margin:0;font-size:26px;font-weight:650;letter-spacing:-.02em}
.login-card p{margin:8px 0 28px;color:var(--muted);font-size:14px}
.login-card button{width:100%;margin-top:18px}
.topbar{height:64px;padding:0 max(24px,calc((100vw - 1120px)/2));display:flex;align-items:center;gap:28px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.96);position:sticky;top:0;z-index:10}
.brand{display:flex;align-items:center;font-size:16px;font-weight:650;white-space:nowrap}
.topbar nav{display:flex;align-items:center;gap:4px;flex:1}
.nav-button{border:0;background:transparent;padding:8px 12px;color:var(--muted)}
.nav-button:hover{color:var(--ink);background:var(--soft)}
.nav-button.active{color:var(--ink);background:var(--soft)}
.workspace{max-width:1120px;margin:0 auto;padding:36px 24px 72px}
.view{display:none}
.view.active{display:block}
.section-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:20px}
.section-heading h1{margin:0;font-size:26px;font-weight:650;letter-spacing:-.02em}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:28px}
.form-grid{display:grid;grid-template-columns:1fr 1fr 180px;gap:20px 16px}
.wide{grid-column:1/-1}
label{display:flex;flex-direction:column;gap:7px;color:#3f3f46;font-size:13px;font-weight:500}
input,select,textarea{width:100%;border:1px solid var(--line-strong);border-radius:7px;background:var(--surface);color:var(--ink);padding:10px 11px;outline:none;font-weight:400}
textarea{resize:vertical;line-height:1.65}
input:hover,select:hover,textarea:hover{border-color:#a1a1aa}
input:focus,select:focus,textarea:focus{border-color:#71717a;box-shadow:0 0 0 3px rgba(113,113,122,.12)}
button{border:1px solid var(--line-strong);border-radius:7px;background:var(--surface);color:var(--ink);padding:9px 14px}
button:hover{background:var(--soft)}
.primary,.login-card button{border-color:var(--ink);background:var(--ink);color:#fff}
.primary:hover,.login-card button:hover{background:#2f2f33}
.ghost-button{background:transparent}
.icon-button{border:0;background:transparent;font-size:26px;line-height:1;padding:6px;color:var(--muted)}
.form-footer{display:flex;align-items:center;justify-content:space-between;gap:24px;border-top:1px solid var(--line);padding-top:20px}
.form-footer p{margin:0;color:var(--muted);font-size:12px;font-weight:400}
.optional,.muted{color:var(--muted);font-size:12px;font-weight:400}
.notice{margin:0;padding:12px 14px;border:1px solid var(--line);border-radius:7px;background:var(--soft);color:#52525b;font-size:12px;line-height:1.6}
.form-error{min-height:18px;margin-top:8px;color:var(--danger);font-size:13px;font-weight:400}
.editor-layout{display:grid;grid-template-columns:260px 1fr;gap:16px}
.item-list{height:max-content;max-height:720px;overflow:auto;padding:6px;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.item-button{display:block;width:100%;padding:13px 12px;border:0;border-radius:6px;background:transparent;text-align:left}
.item-button:hover{background:var(--soft)}
.item-button.active{background:var(--soft);color:var(--ink)}
.item-button strong{display:block;margin-bottom:4px;font-weight:600}
.item-button small{color:var(--muted);font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace}
.editor-form{display:flex;flex-direction:column;gap:18px}
.history-list{display:grid;gap:10px}
.history-item{width:100%;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px;align-items:center;padding:18px 20px;border:1px solid var(--line);border-radius:9px;background:var(--surface);text-align:left}
.history-item:hover{border-color:var(--line-strong);background:var(--surface)}
.history-item h3{margin:0 0 6px;overflow:hidden;font-size:16px;font-weight:600;text-overflow:ellipsis;white-space:nowrap}
.history-item p{margin:0;color:var(--muted);font-size:12px}
.status{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:11px}
.status:before{content:"";width:7px;height:7px;border-radius:50%;background:var(--muted)}
.status.completed:before{background:var(--success)}
.status.running:before,.status.queued:before{background:var(--warn);animation:pulse 1.6s infinite}
.status.failed:before{background:var(--danger)}
@keyframes pulse{50%{opacity:.35}}
dialog{width:min(960px,calc(100vw - 32px));height:min(88vh,1000px);padding:0;border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 24px 64px rgba(0,0,0,.16)}
dialog::backdrop{background:rgba(24,24,27,.45)}
.dialog-head{display:flex;align-items:start;justify-content:space-between;padding:22px 24px;border-bottom:1px solid var(--line);background:var(--surface);position:sticky;top:0;z-index:2}
.dialog-head h2{margin:7px 0 0;font-size:22px;font-weight:650}
.detail-meta{padding:14px 24px;border-bottom:1px solid var(--line);color:var(--muted);font-size:12px}
#detail-error{padding:0 24px}
.output-actions{padding:12px 24px 0;text-align:right}
.novel-output{margin:0;padding:18px 48px 56px;white-space:pre-wrap;word-break:break-word;color:#27272a;font:16px/2 "Noto Serif SC","Songti SC",SimSun,serif}
.toast{position:fixed;right:24px;bottom:24px;padding:11px 15px;border-radius:7px;background:var(--ink);color:#fff;font-size:13px;opacity:0;transform:translateY(8px);pointer-events:none;transition:.2s}
.toast.show{opacity:1;transform:none}
.empty{padding:44px;border:1px dashed var(--line-strong);border-radius:9px;color:var(--muted);text-align:center}
@media(max-width:800px){
  .topbar{height:auto;min-height:60px;flex-wrap:wrap;padding:12px 16px;gap:8px}
  .topbar nav{order:3;flex:0 0 100%;width:100%;overflow:auto}
  .topbar #logout{margin-left:auto}
  .nav-button{flex:0 0 auto;padding:8px 11px;white-space:nowrap}
  .workspace{padding:28px 16px 56px}
  .section-heading h1{font-size:24px}
  .form-grid{grid-template-columns:1fr}
  .wide{grid-column:auto}
  .editor-layout{grid-template-columns:1fr}
  .item-list{display:flex;max-height:none;overflow:auto}
  .item-button{min-width:200px}
  .panel{padding:20px}
  .form-footer{align-items:stretch;flex-direction:column}
  .novel-output{padding:18px 22px 48px}
  .dialog-head,.detail-meta{padding-left:20px;padding-right:20px}
}
