/* 应用布局（只引用 tokens.css 中的变量） */
:root { --side-w: 300px; --chat-w: 340px; }

.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px; background: var(--panel); box-shadow: 0 1px 0 var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; flex: none; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.brand-sub { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.steps { display: flex; gap: 4px; margin: 0 auto; background: var(--fill); padding: 3px; border-radius: 99px; }
.step { padding: 4px 14px; border-radius: 99px; font-size: 12.5px; color: var(--text-3); font-weight: 500; transition: background 0.2s, color 0.2s; }
.step.done { color: var(--text-2); }
.step.current { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 13px; border: 0; border-radius: 99px; background: var(--fill); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.status-pill:hover { background: var(--fill-hover); color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); flex: none; }
.dot.ok { background: var(--success); }
.dot.warn { background: var(--warning); }
.dot.err { background: var(--danger); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--side-w) 1fr var(--chat-w); gap: 12px; padding: 12px; }
.side { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.side-left { padding-bottom: 4px; }
.card { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.card-head.small h3 { font-size: 14px; }
.num { width: 20px; height: 20px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 600; display: grid; place-items: center; flex: none; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.full { width: 100%; }
.meta { font-size: 12px; color: var(--text-3); line-height: 1.6; }
.sub-label { font-size: 12px; color: var(--text-2); font-weight: 500; margin-top: 2px; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--text-3); line-height: 1.6; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.chip { display: inline-flex; align-items: center; }
.chip:disabled, .btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.form-check { font-size: 12.5px; color: var(--text-2); }
textarea.input { resize: none; }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 86px; border-radius: var(--r); background: var(--panel-2); color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: background 0.15s, color 0.15s, box-shadow 0.15s; }
.drop:hover, .drop.over { background: var(--primary-soft); color: var(--primary); }
.drop.over { box-shadow: inset 0 0 0 2px var(--primary); }

.joint-list { max-height: 210px; overflow: auto; border-radius: var(--r); background: var(--panel-2); padding: 4px; font-size: 12.5px; }
.joint-list .empty { color: var(--text-3); padding: 10px; text-align: center; }
.joint-item { display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 7px; cursor: pointer; white-space: nowrap; color: var(--text); }
.joint-item:hover { background: var(--hover); }
.joint-item.sel { background: var(--primary-soft); color: var(--primary); }
.joint-item .pad { flex: none; }
.joint-item .end { color: var(--text-3); }

.progress { height: 6px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--primary); border-radius: 99px; transition: width 0.2s; }

.stage { position: relative; min-width: 0; min-height: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--canvas); box-shadow: var(--shadow-card); display: flex; flex-direction: column; }
.viewport { flex: 1; min-height: 0; position: relative; }
.viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-tip { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--text-3); font-size: 14px; pointer-events: none; text-align: center; }
.busy { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; background: var(--panel); border-radius: 99px; box-shadow: var(--shadow-pop); font-size: 13px; font-weight: 500; animation: popIn 0.18s ease-out; max-width: calc(100% - 32px); }
.busy .spinner { width: 18px; height: 18px; border-width: 2px; flex: none; }
.timeline { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel); box-shadow: 0 -1px 0 var(--line); }
.tl-play { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; transition: transform 0.15s, background 0.15s; }
.tl-play:hover { background: var(--primary-hover); }
.tl-play:active { transform: scale(0.92); }
.tl-play:disabled { background: var(--fill); color: var(--text-4); }
.tl-clip { width: 150px; height: 30px; }
.tl-speed { width: 72px; height: 30px; }
.tl-time { font-size: 12px; color: var(--text-2); width: 92px; text-align: right; }

.chat { min-height: 0; }
.chat-card { flex: 1; min-height: 0; padding: 16px 0 14px; gap: 10px; }
.chat-card > .card-head { padding: 0 12px 0 16px; }
.chat-log { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 16px; }
.msg { max-width: 92%; padding: 9px 13px; border-radius: 16px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; animation: riseIn 0.25s var(--ease-out); }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--panel-2); color: var(--text); border-bottom-left-radius: 6px; }
.msg.intro { color: var(--text-2); }
.msg .info { display: block; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.msg .clip-card { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel); font-size: 12px; white-space: normal; }
.msg .clip-card b { font-weight: 600; }
.msg .clip-card .muted { flex: 1; }
.msg .warn { display: block; margin-top: 6px; font-size: 12px; color: var(--warning); }
.msg.err { background: var(--danger-bg); color: var(--danger); }
.msg .typing { color: var(--text-3); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; }
.quick .chip { height: 26px; padding: 0 11px; font-size: 12px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 0 16px; }
.composer textarea { flex: 1; min-height: 56px; max-height: 160px; }
.composer .btn { height: 36px; }

.segmented { display: flex; background: var(--fill); padding: 3px; border-radius: 10px; gap: 2px; margin-top: 6px; }
.segmented button { flex: 1; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 500; transition: background 0.15s, color 0.15s; }
.segmented button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.segmented button:disabled { opacity: 0.45; cursor: default; }
.modal.settings { width: 480px; }
.modal-footer { align-items: center; }
.test-result { flex: 1; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }

[hidden] { display: none !important; }

@media (max-width: 1180px) {
  :root { --side-w: 270px; --chat-w: 300px; }
  .brand-sub { display: none; }
}
@media (max-width: 960px) {
  html, body { overflow: auto; height: auto; }
  #app { height: auto; min-height: 100%; }
  .steps { display: none; }
  .layout { grid-template-columns: 1fr; padding: 12px 16px; }
  .side { overflow: visible; }
  .stage { height: 62vh; order: -1; }
  .chat-card { min-height: 520px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 8px 0 16px; gap: 8px; }
  .status-pill span { display: none; }
  .status-pill { padding: 0 11px; }
  .timeline { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .timeline input[type='range'] { order: 10; flex-basis: 100%; }
  .tl-clip { flex: 1; width: auto; }
  .tl-time { width: auto; }
}
