/* TopxAI 纸面 1.1 的组件样式，取自设计稿 ui.css，1.1 的补充在文件末尾。颜色、间距、圆角、阴影读 tokens.css 的变量；字号直接写数值，对应 tokens.json 里的 fs-* 样式。 */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13px/20px var(--font-ui); color: var(--text); background: var(--bg-canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.lg { width: 18px; height: 18px; }
.mono { font-family: var(--font-mono); }
.t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* window */
.win { width: 1440px; height: 900px; display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: minmax(0, 1fr); background: var(--bg-app); overflow: hidden; position: relative; }
.win.no-side { grid-template-columns: 1fr; }
.traffic { display: flex; gap: 8px; }
.traffic i { width: 12px; height: 12px; border-radius: 50%; background: #ec6a5e; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.12); }
.traffic i:nth-child(2) { background: #f4bf4f; } .traffic i:nth-child(3) { background: #61c554; }
[data-theme="dark"] .traffic i { box-shadow: inset 0 0 0 0.5px rgba(255,255,255,.1); }

/* sidebar */
.side { display: flex; flex-direction: column; padding: 0 10px; min-height: 0; }
.side-top { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 10px; }
.iconbtn { width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--text-2); position: relative; }
.iconbtn:hover, .iconbtn.hover { background: var(--bg-hover); color: var(--text); }
.iconbtn .dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg-app); }
.newchat { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--r-md); background: var(--bg-raised); border: 1px solid var(--border); box-shadow: var(--shadow-1); font-weight: 500; margin-bottom: 6px; }
.newchat .kbd { margin-left: auto; }
.kbd { font: 500 11px/16px var(--font-ui); color: var(--text-3); padding: 0 5px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg-canvas); letter-spacing: .02em; }
.row { height: var(--row-h); display: flex; align-items: center; gap: 9px; padding: 0 10px; border-radius: var(--r-md); color: var(--text-2); white-space: nowrap; position: relative; }
.row > span.lbl { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.row:hover, .row.hover { background: var(--bg-hover); color: var(--text); }
.row.on { background: var(--bg-selected); color: var(--text); }
.row .meta { margin-left: auto; font-size: 12px; color: var(--text-3); }
.row .meta.warn { color: var(--warning); } .row .meta.is-live { color: var(--accent-text); }
.row.on .meta { color: var(--text-2); }
.row .badge-n { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font: 600 11px/18px var(--font-ui); text-align: center; }
.row.sub { padding-left: 34px; height: 30px; }
.row.proj { color: var(--text); font-weight: 500; gap: 8px; }
.row.proj .chev { color: var(--text-3); margin-left: -4px; }
.pav { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font: 700 9.5px/1 var(--font-ui); color: #fff; letter-spacing: .02em; flex: none; }
.sect { display: flex; align-items: center; justify-content: space-between; height: 28px; padding: 0 10px; margin-top: 14px; font: 600 11px/16px var(--font-ui); color: var(--text-3); letter-spacing: .03em; }
.sect .acts { display: flex; gap: 2px; opacity: .9; }
.sect .acts .iconbtn { width: 22px; height: 22px; }
.st { width: 16px; height: 16px; display: grid; place-items: center; flex: none; }
.st .d { width: 7px; height: 7px; border-radius: 50%; }
.st .d.run { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.st .d.wait { background: var(--warning-dot); box-shadow: 0 0 0 3px var(--warning-soft); }
.st .d.unread { background: var(--accent); }
.st .d.idle { background: transparent; border: 1.5px solid var(--border-strong); width: 6px; height: 6px; }
.side-scroll { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 1px; }
.side-foot { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 8px; border-top: 1px solid var(--border-subtle); margin: 0 -10px; padding-left: 18px; padding-right: 12px; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 12px/1 var(--font-ui); background: #3a352d; color: #f3efe6; flex: none; }
.who { display: flex; flex-direction: column; line-height: 17px; min-width: 0; }
.who b { font-weight: 500; } .who span { font-size: 12px; color: var(--text-3); }
.side-foot .foot-tools { margin-left: auto; display: flex; gap: 2px; }

/* main */
.main { background: var(--bg-canvas); display: flex; flex-direction: column; min-width: 0; position: relative; border-left: 1px solid var(--border-subtle); }
.mhead { height: var(--header-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 24px; border-bottom: 1px solid transparent; }
.mhead.line { border-bottom-color: var(--border-subtle); }
.mhead .ttl { font-weight: 600; font-size: 14px; }
.mhead .crumb { display: flex; align-items: center; gap: 5px; color: var(--text-3); font-size: 12px; }
.mhead .sep { width: 1px; height: 14px; background: var(--border); }
.mhead .right { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
.body.with-panel { grid-template-columns: 1fr var(--panel-w); }
.thread { overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; min-height: 0; }
.col { width: var(--chat-w); }

/* messages */
.msg-user { align-self: flex-end; max-width: 78%; background: var(--bg-user); padding: 9px 14px; border-radius: 16px 16px 4px 16px; font-size: 15px; line-height: 26px; }
.u-wrap { display: flex; flex-direction: column; }
.prose { font-size: 15px; line-height: 26px; color: var(--text); }
.prose p { margin: 0 0 12px; }
.prose ol, .prose ul { margin: 0 0 12px; padding-left: 22px; } .prose li { margin: 2px 0; padding-left: 2px; }
.prose li::marker { color: var(--text-3); }
.prose h3 { font-size: 15px; line-height: 22px; margin: 18px 0 6px; font-weight: 600; }
.ic { font: 500 0.86em/1 var(--font-mono); background: var(--code-bg); color: var(--code-text); padding: 2px 4px; border-radius: var(--r-xs); }
.fp { display: inline-flex; align-items: center; gap: 4px; font: 500 0.86em/1 var(--font-mono); color: var(--accent-text); padding: 2px 6px 2px 4px; border-radius: var(--r-xs); background: var(--accent-soft); vertical-align: 1px; }
.fp .i { width: 12px; height: 12px; }
.meta-row { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 2px 0 0; }
.meta-row .model { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.meta-row .acts { display: flex; gap: 0; margin-left: -6px; }
.meta-row .acts .iconbtn { width: 26px; height: 26px; color: var(--text-3); }

.tools { border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--bg-raised); margin: 4px 0 14px; overflow: hidden; }
.tools-h { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--text-2); }
.tools-h b { color: var(--text); font-weight: 500; }
.tools-h .i.chev { margin-left: auto; color: var(--text-3); }
.step > span:first-child { display: grid; place-items: center; }
.step .v { font-family: var(--font-ui); color: var(--text-2); margin-right: 6px; }
.step { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--text-2); }
.step .cmd { font: 12px/1 var(--font-mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .dur { color: var(--text-3); font-variant-numeric: tabular-nums; }
.ok { color: var(--success); } .bad { color: var(--danger); } .run { color: var(--accent-text); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-full); font: 500 11.5px/20px var(--font-ui); }
.tag.ok { background: var(--success-soft); } .tag.bad { background: var(--danger-soft); } .tag.warn { background: var(--warning-soft); color: var(--warning); }
.tag.neutral { background: var(--bg-sunken); color: var(--text-2); border: 1px solid var(--border-subtle); }
.tag.info { background: var(--accent-soft); color: var(--accent-text); }

.code { border: 1px solid var(--border-subtle); background: var(--bg-sunken); border-radius: var(--r-lg); margin: 4px 0 14px; overflow: hidden; }
.code-h { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; font-size: 12px; color: var(--text-3); border-bottom: 1px solid var(--border-subtle); }
.code-h .path { font-family: var(--font-mono); color: var(--text-2); }
.code-h .acts { margin-left: auto; display: flex; }
.code-h .iconbtn { width: 26px; height: 26px; color: var(--text-3); }
.code pre { font-variant-ligatures: none; margin: 0; padding: 12px 14px 14px; font: 12.5px/20px var(--font-mono); color: var(--code-text); white-space: pre; }
.k { color: var(--syn-keyword); } .f { color: var(--syn-fn); } .s { color: var(--syn-string); } .ty { color: var(--syn-type); } .c { color: var(--syn-comment); }
.diff { border: 1px solid var(--border-subtle); background: var(--bg-raised); border-radius: var(--r-lg); margin: 4px 0 14px; }
.diff-h { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 12px; }
.diff-r { height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-top: 1px solid var(--border-subtle); font: 12px/1 var(--font-mono); }
.diff-r .n { margin-left: auto; display: flex; gap: 8px; }
.plus { color: var(--success); } .minus { color: var(--danger); }

/* buttons */
.btn { height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border-radius: var(--r-md); font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.lg { height: 40px; padding: 0 16px; font-size: 14px; border-radius: var(--r-btn-lg); }
.btn.pri { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 1px 2px rgba(20, 40, 120, .25); }
.btn.pri:hover, .btn.pri.hover { background: var(--accent-hover); }
.btn.pri.press { background: var(--accent-pressed); }
.btn.sec { background: var(--bg-raised); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-1); }
.btn.sec:hover, .btn.sec.hover { background: var(--bg-hover); }
.btn.ghost { color: var(--text-2); } .btn.ghost:hover, .btn.ghost.hover { background: var(--bg-hover); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.dis { opacity: var(--disabled-opacity); pointer-events: none; }
.btn.focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn .kbd { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.12); color: inherit; }
.btn.sec .kbd, .btn.ghost .kbd { border-color: var(--border); background: var(--bg-canvas); color: var(--text-3); }

/* composer */
.composer-wrap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; padding: 0 0 20px; background: linear-gradient(to bottom, transparent, var(--bg-canvas) 28px); }
.composer { width: var(--composer-w); background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-2); position: relative; }
.composer.focus { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-2), var(--focus-ring); }
.composer .input { padding: 14px 16px 6px; font-size: 15px; line-height: 26px; color: var(--text); min-height: 58px; }
.composer .input .ph { color: var(--text-3); }
.composer .input .caret { display: inline-block; width: 1.5px; height: 18px; background: var(--accent); vertical-align: -3px; margin-left: 1px; }
.composer .input .mention { color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 1px 4px; }
.cbar { display: flex; align-items: center; gap: 2px; padding: 6px 8px 8px; }
.chip { height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: var(--r-md); color: var(--text-2); font-size: 13px; white-space: nowrap; }
.chip:hover, .chip.hover, .chip.open { background: var(--bg-hover); color: var(--text); }
.chip.model { color: var(--text); font-weight: 500; }
.chip .i.chev { width: 12px; height: 12px; color: var(--text-3); margin-left: -2px; }
.vsep { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-md); background: var(--bg-sunken); border: 1px solid var(--border-subtle); gap: 2px; }
.seg span { height: 24px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border-radius: 6px; font-size: 12.5px; color: var(--text-2); }
.seg span.on { background: var(--bg-raised); color: var(--text); box-shadow: 0 1px 2px rgba(31,29,26,.08), 0 0 0 1px var(--border-subtle); font-weight: 500; }
[data-theme="dark"] .seg span.on { background: var(--bg-selected); box-shadow: none; }
.cbar .right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.send { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.send.off { background: var(--bg-selected); color: var(--text-4); }
.send.stop { background: var(--bg-inverse); color: var(--text-inverse); }
.send.stop .sq { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.cfoot { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border-top: 1px solid var(--border-subtle); background: var(--bg-sunken); border-radius: 0 0 var(--r-xl) var(--r-xl); font-size: 12px; color: var(--text-2); }
.cfoot .chip { height: 24px; font-size: 12px; padding: 0 7px; gap: 5px; }
.cfoot .chip .i { width: 13px; height: 13px; }
.cfoot .right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--text-3); }
.ctx-meter { display: inline-flex; align-items: center; gap: 6px; }
.ctx-meter .bar { width: 44px; height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.ctx-meter .bar i { display: block; height: 100%; background: var(--text-3); }
.composer.running::before { content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--accent) 40%, color-mix(in srgb, var(--accent) 30%, transparent) 70%, transparent); }

/* dock above composer: approval, question, queue share one card */
.dock { width: var(--composer-w); background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); margin-bottom: 8px; overflow: hidden; }
.dk { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; padding: 12px 12px 12px 14px; align-items: start; }
.dk + .dk { border-top: 1px solid var(--border-subtle); }
.dk .ico { width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; }
.dk .ico.warn { background: var(--warning-soft); color: var(--warning); }
.dk .ico.info { background: var(--accent-soft); color: var(--accent-text); }
.dk .ico.mute { background: var(--bg-sunken); color: var(--text-2); }
.dk h4 { margin: 0; font-size: 13px; font-weight: 600; line-height: 20px; }
.dk .sub { color: var(--text-3); font-size: 12px; line-height: 18px; }
.dk .cmdbox { margin-top: 8px; font: 12.5px/18px var(--font-mono); background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 7px 10px; color: var(--text); }
.dk .cmdbox .pr { color: var(--text-3); margin-right: 6px; }
.dk .acts { display: flex; gap: 6px; align-items: center; }
.dk .acts.under { margin-top: 10px; }
.dk.compact { align-items: center; padding-top: 9px; padding-bottom: 9px; }
.qprev { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-live { display: flex; align-items: center; gap: 10px; padding: 0 2px; }

/* live step in the thread */
.live { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: var(--r-lg); background: var(--bg-raised); border: 1px solid var(--border-subtle); color: var(--text-2); font-size: 12px; margin: 4px 0 12px; }
.live .cmd { font: 12px/1 var(--font-mono); color: var(--text); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-soft-2); border-top-color: var(--accent); flex: none; }

/* popover / menu */
.pop { position: absolute; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-3); overflow: hidden; z-index: 5; }
.pop-search { height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border-subtle); color: var(--text-3); }
.pop-search .q { color: var(--text); flex: 1; }
.mi { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-md); margin: 0 6px; }
.mi:hover, .mi.hover { background: var(--bg-hover); }
.mi.on { background: var(--accent-soft); }
.mi .nm { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.mi .ds { font-size: 12px; color: var(--text-3); line-height: 17px; }
.mi .rt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.mi.dis .nm, .mi.dis .ds { color: var(--text-4); }
.mlabel { font: 600 11px/16px var(--font-ui); color: var(--text-3); padding: 10px 16px 4px; letter-spacing: .03em; }

/* panel */
.panel { border-left: 1px solid var(--border-subtle); background: var(--bg-canvas); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 2px; align-items: center; height: 44px; padding: 0 10px; border-bottom: 1px solid var(--border-subtle); }
.tabs span { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); }
.tabs span.on { background: var(--bg-selected); color: var(--text); font-weight: 500; }
.tabs .right { margin-left: auto; display: flex; }

/* progress */
.prog { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; display: flex; }
.prog i { display: block; height: 100%; }

/* agent chip */
.ag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 3px; border-radius: var(--r-full); background: var(--bg-sunken); border: 1px solid var(--border-subtle); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ag .a { width: 16px; height: 16px; border-radius: 50%; color: #fff; font: 700 9px/16px var(--font-ui); text-align: center; }

/* toggle, check, field */
.tgl { width: 30px; height: 18px; border-radius: 9px; background: var(--border-strong); position: relative; flex: none; }
.tgl::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.tgl.on { background: var(--accent); } .tgl.on::after { left: 14px; }
.field { height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: var(--r-md); background: var(--bg-raised); border: 1px solid var(--control-border); color: var(--text); }
.field.focus { border-color: var(--focus); box-shadow: var(--focus-ring); }
.field.err { border-color: var(--danger-dot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger-dot) 18%, transparent); }
.field .ph { color: var(--text-3); }

/* paper grain + ink bloom for launch and sign-in */
.grain { position: absolute; inset: 0; pointer-events: none; opacity: 0.35; mix-blend-mode: multiply; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 0 0.33  0 0 0 0.18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
[data-theme="dark"] .grain { mix-blend-mode: screen; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.96  0 0 0 0 0.9  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.appicon { border-radius: 22.5%; background: linear-gradient(180deg, #3175f7 0%, #1f4ed6 100%); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 -2px 6px rgba(10,25,90,.25), 0 10px 30px -8px rgba(36,88,239,.45), 0 2px 4px rgba(20,30,70,.18); position: relative; overflow: hidden; }
.appicon::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.18), transparent 46%); }
.appicon svg { width: 62%; height: 62%; position: relative; z-index: 1; filter: drop-shadow(0 1px 1px rgba(10,20,80,.25)); }
.display { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 38px; letter-spacing: -0.01em; }
.body.with-panel .col { width: 680px; }
.body.with-panel .composer, .body.with-panel .dock { width: 700px; }
.i.fill { fill: currentColor; }

/* check and radio */
.chk { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-strong); background: var(--bg-raised); display: inline-grid; place-items: center; flex: none; color: var(--on-accent); }
.chk.on { background: var(--accent); border-color: var(--accent); }
.chk .i { width: 12px; height: 12px; stroke-width: 2.4; }
.rad { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--bg-raised); display: inline-grid; place-items: center; flex: none; }
.rad.on { border: 5px solid var(--accent); background: #fff; }

/* menu and tooltip */
.menu { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 6px 0; width: 232px; }
.menu-i { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 10px; margin: 0 6px; border-radius: var(--r-sm); color: var(--text); }
.menu-i .i { color: var(--text-2); }
.menu-i.hover { background: var(--bg-hover); }
.menu-i .kbd { margin-left: auto; }
.menu-i .chev { margin-left: auto; color: var(--text-3); }
.menu-i.danger, .menu-i.danger .i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border-subtle); margin: 6px 0; }
.tip { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 8px; border-radius: var(--r-sm); background: var(--bg-inverse); color: var(--text-inverse); font-size: 12px; box-shadow: var(--shadow-2); }
.tip .kbd { background: transparent; border-color: color-mix(in srgb, var(--text-inverse) 30%, transparent); color: color-mix(in srgb, var(--text-inverse) 75%, transparent); }

/* toast, banner, empty state */
.toast { display: flex; align-items: center; gap: 10px; width: 360px; padding: 10px 10px 10px 14px; border-radius: var(--r-lg); background: var(--bg-raised); border: 1px solid var(--border); box-shadow: var(--shadow-3); }
.toast .msg { flex: 1; min-width: 0; }
.toast .msg b { display: block; font-weight: 500; }
.toast .msg span { color: var(--text-3); font-size: 12px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 12px; border-radius: var(--r-md); border: 1px solid transparent; }
.banner .msg { flex: 1; min-width: 0; color: var(--text-2); }
.banner .msg b { font-weight: 500; margin-right: 6px; }
.banner.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning-dot) 22%, transparent); }
.banner.warn .msg b, .banner.warn > .i { color: var(--warning); }
.banner.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger-dot) 22%, transparent); }
.banner.bad .msg b, .banner.bad > .i { color: var(--danger); }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 16%, transparent); }
.banner.info .msg b, .banner.info > .i { color: var(--accent-text); }
.empty { max-width: 360px; }
.empty .glyph { width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--bg-sunken); border: 1px solid var(--border-subtle); display: grid; place-items: center; color: var(--text-3); margin-bottom: 14px; }
.empty h4 { margin: 0 0 4px; font-size: 15px; line-height: 22px; font-weight: 600; }
.empty p { margin: 0 0 14px; color: var(--text-2); }
.mono, .ic, .fp, .code pre, .step .cmd, .live .cmd, .dk .cmdbox, .diff-r, .diff-h .num { font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
.toast .msg span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .55; margin: 0 -1px; flex: none; }

[data-theme="dark"] .grain { opacity: 0.5; }
.brand-panel { background: linear-gradient(160deg, var(--brand-panel-1) 0%, var(--brand-panel-2) 46%, var(--brand-panel-3) 100%); color: var(--paper); }

/* 预览用的排版辅助，来自设计稿 components.html */
.pv { padding: 20px 24px; }
.cap { font-size: 11px; line-height: 16px; color: var(--text-3); margin-bottom: 8px; letter-spacing: .02em; }
.grid { display: grid; gap: 28px 32px; align-items: start; }
.rowx { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mtx { display: grid; grid-template-columns: 72px repeat(5, max-content); gap: 14px 24px; align-items: center; }
.mtx .h { font-size: 11px; color: var(--text-3); }
.lbl { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.help { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.help.err { color: var(--danger); }
.side-demo { width: 244px; background: var(--bg-app); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); padding: 8px; }
.mask { display: inline-block; width: 108px; height: 8px; background: radial-gradient(circle, currentColor 2.6px, transparent 3.2px) 0 50% / 9px 8px repeat-x; margin-right: -4px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font: 700 12px var(--font-ui); }

/* ===== 1.1 补充 ===== */

/* 真实的交互状态。上面的 .hover、.focus、.press、.dis 只给预览摆状态用。 */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.field:focus-within { border-color: var(--focus); box-shadow: var(--focus-ring); }
.field input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: inherit; padding: 0; }
.field input:focus-visible, .composer .input:focus-visible { outline: none; }
.field input::placeholder { color: var(--text-3); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-2), var(--focus-ring); }
.btn.pri:active { background: var(--accent-pressed); }
.btn.sec:active, .btn.ghost:active { background: var(--bg-selected); }
.btn:disabled, .btn[aria-disabled="true"], .iconbtn:disabled, .chip:disabled, .send:disabled { opacity: var(--disabled-opacity); pointer-events: none; }
.menu-i:hover, .menu-i[data-highlighted] { background: var(--bg-hover); }
.tabs button { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); }
.tabs button:hover { background: var(--bg-hover); color: var(--text); }
.tabs button.on, .tabs button[aria-selected="true"] { background: var(--bg-selected); color: var(--text); font-weight: 500; }
::selection { background: var(--selection); }

/* 按钮等结果：图标换成转圈，文字不变，按钮禁用 */
.btn.busy { pointer-events: none; }
.btn.busy .spin { width: 14px; height: 14px; border-width: 2px; border-color: color-mix(in srgb, currentColor 28%, transparent); border-top-color: currentColor; }

/* 表单控件的轮廓 */
.chk:not(.on), .rad:not(.on) { border-color: var(--control-border); }
.tgl:not(.on) { background: var(--control-border); }
.tgl::after { transition: transform var(--dur-fast) var(--ease-out); }
.tgl.on::after { left: 2px; transform: translateX(12px); }

/* 消息正文里的 Markdown */
.prose h1, .prose h2 { font-size: 15px; line-height: 22px; margin: 18px 0 6px; font-weight: 600; }
.prose h4, .prose h5, .prose h6 { font-size: inherit; line-height: inherit; margin: 12px 0 4px; font-weight: 600; }
.prose > :first-child { margin-top: 0; }
.prose blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 2px solid var(--border); color: var(--text-2); }
.prose table { border-collapse: collapse; margin: 0 0 12px; font-size: 13px; line-height: 20px; }
.prose th { font: 600 11px/16px var(--font-ui); letter-spacing: .03em; color: var(--text-3); text-align: left; padding: 6px 16px 6px 0; border-bottom: 1px solid var(--border); }
.prose td { padding: 6px 16px 6px 0; border-bottom: 1px solid var(--border-subtle); }
.prose .num { text-align: right; font-variant-numeric: tabular-nums; }
.prose a { color: var(--accent-text); text-decoration: none; }
.prose a:hover { text-decoration: underline; text-underline-offset: 2px; }
.prose hr { border: 0; border-top: 1px solid var(--border-subtle); margin: 18px 0; }
.prose img { max-width: 100%; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); }
.meta-row .num { font-variant-numeric: tabular-nums; }

/* 改动对比的行 */
.diff-line { display: grid; grid-template-columns: 44px 16px 1fr; font: 12.5px/20px var(--font-mono); color: var(--code-text); font-variant-ligatures: none; }
.diff-line > span:last-child { white-space: pre; }
.diff-line .ln { color: var(--text-3); text-align: right; padding-right: 10px; font-variant-numeric: tabular-nums; }
.diff-line.add { background: var(--success-soft); } .diff-line.add .sg { color: var(--success); }
.diff-line.del { background: var(--danger-soft); } .diff-line.del .sg { color: var(--danger); }

/* 对话框 */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: var(--overlay); }
.overlay.demo { position: relative; inset: auto; height: 250px; border-radius: var(--r-lg); }
.dialog { width: 420px; max-width: calc(100% - 32px); padding: 20px; border-radius: var(--r-2xl); background: var(--bg-raised); border: 1px solid var(--border); box-shadow: var(--shadow-3); animation: px-pop var(--dur-base) var(--ease-out); }
.dialog h4 { margin: 0 0 6px; font-size: 15px; line-height: 22px; font-weight: 600; }
.dialog p { margin: 0; color: var(--text-2); }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* 右侧面板的预览外框 */
.panel.demo { width: 380px; border: 1px solid var(--border-subtle); border-radius: var(--r-lg); overflow: hidden; }
.panel-body { padding: 16px; font-size: 13px; line-height: 20px; }
.panel-body b { font-size: 20px; line-height: 28px; font-weight: 600; }

/* 动效：只动 transform 和 opacity，颜色可以过渡 */
.btn, .iconbtn, .chip, .row, .menu-i, .mi, .seg span, .tabs button, .tgl, .chk, .rad, .field, .composer { transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
@keyframes px-spin { to { transform: rotate(360deg); } }
@keyframes px-sweep { from { transform: translateX(-30%); } to { transform: translateX(30%); } }
@keyframes px-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes px-pop { from { opacity: 0; transform: scale(.98); } }
.spin { animation: px-spin .8s linear infinite; }
.composer.running { overflow: clip; }
.composer.running::before { top: 0; animation: px-sweep 1.6s ease-in-out infinite alternate; }
.menu, .pop { animation: px-in var(--dur-base) var(--ease-out); }
.toast { animation: px-in var(--dur-slow) var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
  .spin { animation: none; }
  .composer.running::before { transform: none; }
}
