* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: #f2f2f7; color: #1c1c1e; font-size: 15px; }
#topbar { position: sticky; top: 0; z-index: 30; background: rgba(28,28,30,.96); color: #fff; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-btn { background: none; border: 0; color: #fff; font-size: 17px; font-weight: 600; padding: 6px 2px; max-width: 82%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 10px; width: 36px; height: 36px; font-size: 17px; }
main { padding: 14px 14px 150px; max-width: 760px; margin: 0 auto; }
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(255,255,255,.97); border-top: 1px solid #d1d1d6; padding-bottom: env(safe-area-inset-bottom); }
#tabbar button { flex: 1; background: none; border: 0; padding: 7px 0 6px; font-size: 11px; color: #8e8e93; display: flex; flex-direction: column; align-items: center; gap: 2px; }
#tabbar button span { font-size: 20px; }
#tabbar button.active { color: #007aff; }
#subnav { position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 29; display: none; gap: 8px; padding: 8px 12px; overflow-x: auto; background: rgba(242,242,247,.96); }
#subnav.show { display: flex; }
#subnav button { flex: 0 0 auto; border: 1px solid #d1d1d6; background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; }
#subnav button.active { background: #007aff; color: #fff; border-color: #007aff; }
h2 { font-size: 20px; margin: 4px 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card .title { font-weight: 600; font-size: 16px; }
.card .sub { color: #636366; font-size: 13px; margin-top: 3px; line-height: 1.5; word-break: break-word; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.btn { border: 0; border-radius: 10px; padding: 9px 14px; font-size: 14px; background: #e5e5ea; color: #1c1c1e; }
.btn.primary { background: #007aff; color: #fff; }
.btn.danger { background: #ff3b30; color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .45; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef4ff; color: #0055c4; margin-right: 4px; }
.badge.gray { background: #eee; color: #555; }
.badge.red { background: #ffe9e8; color: #c81e1e; }
.badge.green { background: #e5f7e8; color: #14702c; }
input, select, textarea { width: 100%; border: 1px solid #d1d1d6; border-radius: 10px; padding: 10px; font-size: 15px; background: #fff; margin: 4px 0 10px; font-family: inherit; }
textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
textarea.tall { min-height: 300px; }
label { font-size: 13px; color: #636366; font-weight: 600; }
.search { margin-bottom: 10px; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.modal h3 { margin-top: 0; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 130px; z-index: 99; background: rgba(28,28,30,.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; display: none; max-width: 88vw; text-align: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fff; border-radius: 14px; padding: 14px 8px; text-align: center; }
.stat b { font-size: 22px; display: block; }
.stat span { font-size: 12px; color: #8e8e93; }
.chat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.msg.user { align-self: flex-end; background: #007aff; color: #fff; }
.msg.assistant { align-self: flex-start; background: #fff; }
.msg.system { align-self: center; background: #fff3cd; color: #664d03; font-size: 12px; }
.chip { display: inline-block; padding: 5px 11px; border-radius: 999px; border: 1px solid #d1d1d6; background: #fff; font-size: 12px; margin: 0 6px 6px 0; }
.chip.on { background: #7d3cff; color: #fff; border-color: #7d3cff; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.switch-row input[type=checkbox] { width: 22px; height: 22px; margin: 0; }
.pipeline-step { border-left: 3px solid #d1d1d6; padding: 6px 0 6px 12px; margin-bottom: 8px; }
.pipeline-step.run { border-color: #007aff; }
.pipeline-step.done { border-color: #34c759; }
.pipeline-step.err { border-color: #ff3b30; }
.pipeline-step .out { background: #f7f7fa; border-radius: 8px; padding: 8px; font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; margin-top: 6px; line-height: 1.6; }
canvas#graph { width: 100%; background: #fff; border-radius: 14px; touch-action: none; display: block; }
.muted { color: #8e8e93; font-size: 13px; line-height: 1.6; }
pre.code { background: #1c1c1e; color: #d7f9d7; padding: 10px; border-radius: 10px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
