/* 云爪数字员工 — colours from yunzhuakeji.com/zh/ :root */
:root {
  --ink: #07152f; --ink-2: #21395d; --muted: #5f7392; --blue: #1267f1; --blue-deep: #0750d8; --blue-2: #63bdff;
  --paper: #f4f9ff; --paper-2: #eaf4ff; --nav: #eef5ff; --on: #dcebff; --card: #ffffff; --line: #d6e4f7;
  --warn-bg: #fbeecb; --warn: #8a5a00; --bad: #c0362c;
  --grad: linear-gradient(135deg, #1267f1, #0750d8);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--paper); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 760; }
h2 { font-size: 17px; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* layout */
.shell { display: flex; height: 100vh; overflow: hidden; }
.side { width: 248px; flex-shrink: 0; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; background: var(--nav); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 24px; }
.brand img { width: 64px; height: 64px; object-fit: contain; }
.brand b { font-size: 18px; font-weight: 760; }
.nav { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; color: var(--ink-2); }
.nav:hover { background: var(--on); color: var(--ink); }
.nav.on { background: var(--on); color: var(--blue); font-weight: 600; }
.nav .tag { margin-left: auto; font-size: 12px; color: var(--blue); }
.side .bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); margin-top: 8px; font-size: 14px; }
.main { flex-grow: 1; min-width: 0; overflow: auto; padding: 32px 40px; display: flex; flex-direction: column; gap: 22px; }
.split { flex-grow: 1; min-width: 0; display: flex; overflow: hidden; }
.split > section { flex-grow: 1; min-width: 0; overflow: auto; padding: 28px 32px; display: flex; flex-direction: column; gap: 18px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid rgba(18, 103, 241, 0.18); background: var(--card); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn.primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 10px 24px rgba(18, 103, 241, 0.26); }
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.input { height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); width: 100%; outline: none; }
.input:focus, textarea:focus { border-color: var(--blue); }
textarea.input { height: auto; padding: 12px 14px; resize: none; line-height: 1.6; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 22px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn.live { background: var(--blue); color: #fff; border: none; animation: pulse 1.2s ease-in-out infinite; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex-grow: 1; }
.grid { display: grid; gap: 16px; }
.ph { background: var(--paper-2); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.badge { white-space: nowrap; font-size: 12px; padding: 3px 10px; border-radius: 10px; background: var(--paper-2); color: var(--blue); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 50; }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login .card { width: 420px; padding: 36px; display: flex; flex-direction: column; gap: 14px; border-radius: 28px; box-shadow: 0 28px 90px rgba(26, 82, 153, 0.14); }

/* agent panel */
.agent { width: 420px; flex-shrink: 0; border-left: 1px solid var(--line); background: #f7fbff; display: flex; flex-direction: column; min-height: 0; }
.agent header { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.agent .body { flex-grow: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.bubble-u { align-self: flex-end; max-width: 80%; background: var(--grad); color: #fff; border-radius: 16px 16px 4px 16px; padding: 11px 14px; line-height: 1.6; white-space: pre-wrap; }
.bubble-a { background: var(--card); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 12px 14px; line-height: 1.7; white-space: pre-wrap; }
.trace { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.trace .step { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-size: 13px; line-height: 1.55; }
.trace .verb { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--paper-2); margin-right: 6px; }
.trace .note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--paper-2); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: fade 1s ease-in-out infinite; }
.bars span { display: inline-block; width: 4px; margin: 0 1.5px; border-radius: 2px; background: var(--blue); animation: wave 0.9s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 20px; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 103, 241, 0.45); } 50% { box-shadow: 0 0 0 10px rgba(18, 103, 241, 0); } }
table.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
table.ledger td, table.ledger th { text-align: left; padding: 10px 6px; border-top: 1px solid var(--line); }
table.ledger th { color: var(--muted); font-weight: 400; font-size: 13px; }

/* chat page */
.split > section.chat { padding: 0; gap: 0; overflow: hidden; }
.chat-top { padding: 16px 28px; border-bottom: 1px solid var(--line); background: var(--card); }
.chat-top select.input { height: 36px; }
.msgs { flex-grow: 1; overflow: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.msgs .bubble-a { align-self: flex-start; max-width: 80%; }
.msgs .empty { margin: auto; text-align: center; max-width: 420px; }
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 14px 28px 20px; border-top: 1px solid var(--line); background: var(--card); }
.composer textarea.input { max-height: 160px; }
.icon-btn.send { background: var(--grad); color: #fff; border: none; }
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.confirm { align-self: flex-start; width: min(520px, 80%); background: var(--card); border: 1px solid var(--blue-2); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 8px 24px rgba(18, 103, 241, 0.08); }
.kv { display: grid; grid-template-columns: 72px 1fr; gap: 10px; font-size: 14px; line-height: 1.6; }
.kv > span { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: #fff; object-fit: contain; padding: 2px; }

/* employee page */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 6px; }
.persona { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 13px; }
.persona b { font-size: 15px; }
.persona.on { border: 2px solid var(--blue); background: var(--paper-2); }
.memrow { padding: 8px 0; border-top: 1px solid var(--line); }
.warnbox { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.bubble-u.pending { opacity: 0.7; }

/* ===== 页面小人「小云」 ===== */
#yz-bot { position: fixed; right: 28px; bottom: 24px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.yzb-avatar { width: 88px; height: 100px; border: none; background: none; padding: 0; cursor: pointer; position: relative; filter: drop-shadow(0 12px 22px rgba(18, 103, 241, 0.28)); animation: yzb-float 3.2s ease-in-out infinite; }
.yzb-avatar svg { width: 100%; height: 100%; }
.yzb-avatar .eyes { transform-origin: 60px 62px; animation: yzb-blink 4.5s infinite; }
#yz-bot[data-mood="talking"] .mouth { animation: yzb-talk 0.28s ease-in-out 6 alternate; transform-origin: 60px 74px; }
#yz-bot[data-mood="thinking"] .yzb-avatar { animation: yzb-nod 0.9s ease-in-out infinite; }
#yz-bot[data-mood="working"] .yzb-avatar { animation: yzb-work 0.6s ease-in-out infinite; }
.yzb-dot { position: absolute; right: 6px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
#yz-bot[data-mood="thinking"] .yzb-dot, #yz-bot[data-mood="working"] .yzb-dot { background: var(--blue); animation: fade 0.8s infinite; }
.yzb-panel { width: 360px; max-height: min(560px, calc(100vh - 160px)); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px rgba(7, 21, 47, 0.18); overflow: hidden; }
.yzb-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--grad); color: #fff; }
.yzb-status { font-size: 12px; opacity: 0.85; flex-grow: 1; }
.yzb-x { border: none; background: transparent; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; }
.yzb-msgs { flex-grow: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.yzb-m { max-width: 86%; padding: 9px 12px; border-radius: 14px; line-height: 1.6; white-space: pre-wrap; font-size: 14px; }
.yzb-m.assistant { align-self: flex-start; background: var(--paper-2); border-radius: 4px 14px 14px 14px; }
.yzb-m.user { align-self: flex-end; background: var(--grad); color: #fff; border-radius: 14px 14px 4px 14px; }
.yzb-card { align-self: stretch; border: 1px solid var(--blue-2); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; background: #fff; }
.yzb-confirm { border-width: 2px; }
.yzb-box { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.yzb-box textarea { flex-grow: 1; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; resize: none; max-height: 96px; outline: none; font-size: 14px; }
.yzb-box textarea:focus { border-color: var(--blue); }
.yzb-send, .yzb-stop { height: 36px; padding: 0 14px; border-radius: 18px; border: none; cursor: pointer; font-weight: 600; }
.yzb-send { background: var(--grad); color: #fff; } .yzb-send:disabled { opacity: 0.5; cursor: not-allowed; }
.yzb-stop { background: #fde2e1; color: var(--bad); }
.yzb-cursor { position: fixed; left: 0; top: 0; width: 30px; height: 30px; z-index: 70; pointer-events: none; transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1); filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)); }
.yzb-cursor svg { width: 100%; height: 100%; } .yzb-cursor.press svg { transform: scale(0.8); transition: transform 0.1s; }
.yzb-target { outline: 3px solid var(--blue-2) !important; outline-offset: 3px; border-radius: 10px; transition: outline 0.2s; }
@keyframes yzb-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes yzb-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes yzb-talk { from { transform: scaleY(1); } to { transform: scaleY(2.2); } }
@keyframes yzb-nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
@keyframes yzb-work { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(3deg); } }
@media (prefers-reduced-motion: reduce) { .yzb-avatar, .yzb-avatar .eyes, .yzb-cursor { animation: none !important; transition: none !important; } }
/* Live2D 看板娘：上半身，约 190×250，放在右下角；动画由模型自己做，关掉 SVG 的漂浮 */
.yzb-l2d { width: 190px; height: 250px; display: block; }
#yz-bot.live2d .yzb-avatar { width: 190px; height: 250px; animation: none; filter: drop-shadow(0 10px 18px rgba(18, 103, 241, 0.18)); }
#yz-bot.live2d .yzb-dot { right: 34px; top: 28px; }
#yz-bot.live2d { right: 16px; bottom: 0; }
/* the hidden attribute must win over display:flex/block set above (panel, cursor, canvas, svg fallback) */
#yz-bot [hidden] { display: none !important; }
.pchip { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 4px 0; padding: 3px 8px 3px 3px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.pchip img { width: 36px; height: 36px; object-fit: cover; border-radius: 7px; background: var(--paper-2); }
.yzb-new { border: 1px solid rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.16); color: #fff; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.yzb-new:hover { background: rgba(255, 255, 255, 0.3); }
.yzb-tip { align-self: stretch; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--warn); background: var(--warn-bg); border-radius: 12px; padding: 8px 10px; line-height: 1.5; }
.yzb-tip .btn { flex-shrink: 0; }

/* result page: versions, chosen image, what the user is talking about */
.vtabs { display: flex; gap: 8px; flex-wrap: wrap; }
.vtab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 120px; max-width: 220px; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; text-align: left; font-size: 13px; position: relative; }
.vtab .spin { position: absolute; right: 8px; top: 9px; }
.vtab.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--on); }
.vtab.reverted { opacity: 0.6; }
.vtab.reverted b { text-decoration: line-through; }
.vinfo { display: flex; flex-direction: column; gap: 8px; }
.work { display: flex; flex-direction: column; gap: 8px; border-radius: 14px; padding: 6px; border: 2px solid transparent; }
.work.picked { border-color: var(--blue); }
.work.focused { background: var(--paper-2); }
.aitag { position: absolute; left: 8px; bottom: 8px; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: rgba(7, 21, 47, .78); color: #fff; }
.pickmark { position: absolute; right: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 4px 10px; border-radius: 10px; background: var(--blue); color: #fff; }
.ph.making { flex-direction: column; gap: 10px; padding: 16px; text-align: center; line-height: 1.6; background: var(--paper-2); }
.focusbar { display: flex; align-items: center; gap: 8px; padding: 8px 18px; border-top: 1px solid var(--line); background: var(--paper-2); font-size: 13px; }
.focusbar[hidden] { display: none; }
.focusbar img { width: 32px; height: 40px; object-fit: cover; border-radius: 6px; background: #fff; }
.focusbar .chip { height: 28px; padding: 0 10px; font-size: 12px; }
.agent .composer { padding: 12px 18px 16px; }
/* the page mascot must not cover a chat input in the right-hand panel (result page) */
body:has(.agent .composer) #yz-bot, body:has(.agent .composer) #yz-bot.live2d { right: 436px; }
